---
title: "How we handle sensitive data in BigQuery"
description: "incident.io masks sensitive data in BigQuery by default: a daily Python job applies PII and confidential policy tags to every untagged STRING/BYTES column replicated by Fivetran, so humans see only SHA256-hashed values."
url: "https://swe.quest/articles/how-we-handle-sensitive-data-in-bigquery-1b75e2ab86e89799"
canonical: "https://incident.io/blog/how-we-handle-sensitive-data-in-big-query"
source: "incident.io"
published: "2024-11-14"
difficulty: "medium"
kind: "Case study"
reading_minutes: 10
tags: ["privacy","analytics","data-pipelines","python","identity-auth"]
---

# How we handle sensitive data in BigQuery

A post on [incident.io](https://swe.quest/sources/incident-io.md), published 2024-11-14, 10 min read, Case study. Original: [https://incident.io/blog/how-we-handle-sensitive-data-in-big-query](https://incident.io/blog/how-we-handle-sensitive-data-in-big-query)

## Summary

incident.io masks sensitive data in BigQuery by default: a daily Python job applies PII and confidential policy tags to every untagged STRING/BYTES column replicated by Fivetran, so humans see only SHA256-hashed values. Non-sensitive columns are allow-listed via PR-edited YAML files, and a slim run diffs against the previous YAML version stored in GCS so only affected tables are processed. dbt is split into a customer-facing pipeline with unmasked access and an internal analytics pipeline that persists masked values downstream. Tagging once at the source cuts human error, at the cost of being unable to derive non-sensitive values such as email domains. The job also syncs a Notion data catalogue and sends Slack alerts.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Privacy](https://swe.quest/tags/privacy.md) (Security)
- [Analytics & OLAP](https://swe.quest/tags/analytics.md) (Data & databases)
- [Data pipelines](https://swe.quest/tags/data-pipelines.md) (Data & databases)
- [Python](https://swe.quest/tags/python.md) (Languages)
- [Identity & auth](https://swe.quest/tags/identity-auth.md) (Security)

## Prerequisites

- BigQuery basics
- dbt
- GCP IAM ([easy posts on Cloud platforms](https://swe.quest/tags/cloud.md?difficulty=easy))

## Keywords

BigQuery, dbt, Fivetran, policy tags, CircleCI, Notion API, Google Cloud Storage

## Related posts

- [Updating our data stack](https://swe.quest/articles/updating-our-data-stack-8fc5fea19caac0a4.md): incident.io · 2022-08-24 · Medium · 12 min read · Data pipelines, Analytics & OLAP, CI/CD, SQL
  incident.io's two-person data team reworked its BigQuery/dbt analytics stack as the company grew from 10 to 30 people.
- [How to Handle PII in Staging Databases Without Losing Realistic Data](https://swe.quest/articles/how-to-handle-pii-in-staging-databases-without-losing-realistic-data-41c0818c53e7c05e.md): Neon · 2025-11-17 · Medium · 11 min read · Privacy, PostgreSQL, Testing, Databases
  Four common ways to get realistic but PII-safe staging data are compared, with code for each: manual CSV export plus Python anonymization scripts, Faker-based masking libraries with deterministic seeding to preserve referential integrity, fully synthetic data generators, and replication into staging with SQL masking views or the PostgreSQL Anonymizer extension (declarative security labels, dynamic masking, anonymized dumps, k-anonymity checks).
- [pg\_redact: Content-aware PII redaction with Jev, enforced in Postgres](https://swe.quest/articles/pg-redact-content-aware-pii-redaction-with-jev-enforced-in-postgres-4dd923bfce10e406.md): Neon · 2026-10-01 · Medium · 9 min read · PostgreSQL, Privacy, LLMs
  Column-level masking in Postgres can't redact PII buried in free text, and regex alone can't tell an SSN from an invoice number. pg\_redact generates candidate spans with regex and capitalization rules, asks TypeSafe's Jev model to label each one (name, email, phone, address, id\_number, none) with calibrated probabilities, and stores spans above 0.5 confidence as JSONB next to the message.
- [From one switch to a control panel: meet \`dataCollection\`](https://swe.quest/articles/from-one-switch-to-a-control-panel-meet-datacollection-1d4b9c6a75983352.md): Sentry · 2026-08-28 · Medium · 6 min read · Privacy, Observability, JavaScript
  Sentry's JavaScript SDK v11 replaces the all-or-nothing \`sendDefaultPii\` boolean with \`dataCollection\`, a per-category config covering user info, cookies, HTTP headers and bodies, query params, GenAI inputs/outputs, database queries and more.
- [Data stack 2024](https://swe.quest/articles/data-stack-2024-acc7f40c0d3042d9.md): incident.io · 2024-08-06 · Medium · 9 min read · Analytics & OLAP, Data pipelines, Developer productivity, Incidents & postmortems
  incident.io's 2024 data stack runs Fivetran and Segment into BigQuery, dbt (run via Docker on CircleCI) for transforms, and Hightouch for reverse ETL.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
