The Simplest Way to Make BigQuery and Databricks Work Like They Should

Published
Length
3 min read

Luis Felipe Dias

All posts

Teams use bigquery and databricks together to run SQL analytics and train machine learning models. This setup lets data engineers read warehouse tables and write spark results back. Many teams store core business tables in Google Cloud. At the same time, data scientists build models in spark notebooks. Linking both platforms removes the need to copy every table by hand. A clean setup keeps data fresh and lowers cloud storage bills. How bigquery and databricks move data and check roles Data m

Your coding agents run with your access.

Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.

Teams use bigquery and databricks together to run SQL analytics and train machine learning models. This setup lets data engineers read warehouse tables and write spark results back.

Many teams store core business tables in Google Cloud. At the same time, data scientists build models in spark notebooks. Linking both platforms removes the need to copy every table by hand. A clean setup keeps data fresh and lowers cloud storage bills.

How bigquery and databricks move data and check roles

Data moves between the two systems through cloud storage buckets and fast read APIs. Spark jobs ask the warehouse for table data over a high-speed read stream. When a job writes data back, it stages files in a cloud bucket first. Then the warehouse loads those staged files into the final target table.

To make this work, the compute cluster needs a valid cloud identity. Most teams attach a cloud service account to the spark cluster. That service account holds permissions to read tables and write to staging buckets. When a user runs a notebook, the cluster uses that identity to log in.

You can also use federated login so users sign in with their own identities. This ties every read and write action to a real person on the team. It also makes audit logs much easier to read during a security check.

Common failure modes and how to scope permissions

The biggest risk in this setup is a shared service account with broad permissions. If one cluster has full admin rights, any notebook user can drop warehouse tables. Static JSON keys stored in notebook files create another huge risk. Engineers might copy those keys into git repos or share them in chat apps.

Unlogged queries also cause problems for security and finance teams. When ten people share one cluster identity, warehouse logs show only the service account. You cannot tell which user ran an expensive query or read sensitive rows. Also, raw tables often hold emails, phone numbers, card numbers, or national IDs. Without field controls, notebook queries pull all of those details into spark memory. Data masking rewrites matched fields in results so sensitive strings stay safe.

BigQuery IAM + End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

To fix these risks, split service accounts by team and job type. Give read-only warehouse roles to clusters that only train models or run reports. Give write roles only to automated jobs that build production tables. Scope bucket permissions so a cluster can only touch its own staging folder. Delete old static keys and use short-lived tokens tied to cluster identity instead. Finally, route traffic over private cloud networks instead of the public internet.

Keeping audit logs and costs under control

Cross-cloud data movement can drive up network bills fast if left unchecked. When spark reads huge tables across regions, cloud providers charge for data transfer. Put your staging buckets and warehouse datasets in the same cloud region. Filter rows and pick specific columns before pulling data into the spark cluster.

Good logging helps you spot bad queries before they break your budget. Tag every job run with the user email, team name, and project name. Check your warehouse logs each week to find slow or wasteful table scans. Review role bindings every quarter and remove permissions that teams no longer use.

Govern statements and responses across databases and APIs

Good config and scoped roles are needed setup. They do not check single queries in flight or mask sensitive fields in returned rows. Across Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, and internal HTTP endpoints, hoop.dev runs beside each supported service as an open-source proxy, a sidecar for your database or API.

First, hoop.dev guardrails block banned queries before they run. Then hoop.dev data masking rewrites matched sensitive values in responses in memory. The audit trail records every statement and verdict per resource. Furthermore, hoop.dev holds SOC 2 Type II and is open source on GitHub.

Frequently asked questions

How does spark read data from the warehouse so fast?

The connector uses a storage read API that streams data in parallel. This skips slow text exports and sends binary data straight to spark workers.

Why do write jobs need a cloud storage bucket?

Spark workers write output files in parallel to a temporary staging bucket first. The warehouse then loads those files into the target table in one step.

How can we stop users from reading sensitive columns in notebooks?

Use column-level security rules and data masking on sensitive fields like emails or card numbers. Masking rewrites matched fields in results before the data reaches the notebook.

The query runs. The emails stay hidden.