The Simplest Way to Make Cloud SQL and Dataflow Work Like They Should

Published
Length
3 min read

Luis Felipe Dias

All posts

Running cloud sql and dataflow together lets teams move and change database records at scale. Dataflow workers read or write rows in Cloud SQL during batch and stream jobs. This pair supports analytics pipelines, data syncs, and daily cleanup tasks across your systems. To keep data safe, teams must control how workers log in and run queries. How cloud sql and dataflow share data and roles Dataflow runs jobs across a fleet of worker machines in your cloud project. Each worker opens connection

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.

Running cloud sql and dataflow together lets teams move and change database records at scale. Dataflow workers read or write rows in Cloud SQL during batch and stream jobs.

This pair supports analytics pipelines, data syncs, and daily cleanup tasks across your systems. To keep data safe, teams must control how workers log in and run queries.

How cloud sql and dataflow share data and roles

Dataflow runs jobs across a fleet of worker machines in your cloud project. Each worker opens connections to the database to read tables or write new rows.

Identity and role checks happen before any worker can run a single query. A service account gives the Dataflow worker the right to reach the database instance.

Inside Cloud SQL for PostgreSQL, database roles control what tables that worker can touch. Because it is a managed service, users cannot get true superuser attributes.

Google keeps a system user for top admin tasks that customers cannot change. For admin work, you can grant a custom admin role with high privileges.

That role can create extensions, event triggers, replication users, and replication publications or subscriptions. The default admin user belongs to this group and can create roles and databases.

Still, you must set a password for the default admin user before logging in. Also, the default admin user does not hold true superuser or replication attributes.

Dataflow workers do not need these broad admin rights to move table rows. Instead, create a dedicated database user that only has read or write rights.

End-to-End Encryption + SQL Query Filtering: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Common failure modes and how to scope access

Many teams fail by sharing one admin account across all Dataflow jobs and engineers. When everyone uses the default admin user, you cannot tell who ran a bad query.

Shared passwords also create huge risks if a job log leaks the secret string. Broad tokens let a broken pipeline drop tables instead of just reading rows.

Another common issue happens when engineers run ad-hoc queries to fix failed pipeline runs. Unlogged queries make it hard to track changes or spot data leaks during incidents.

To fix this, give every Dataflow pipeline its own service account and database user. Grant only select rights for read jobs, and insert or update rights for write jobs.

Lock down network paths so workers only reach the database over private cloud networks. Keep human engineers out of shared pipeline accounts when they check data or fix bugs.

When engineers inspect tables with sensitive fields, use data masking to protect private records. Masking rewrites matched fields like emails, phone numbers, card numbers, or national IDs in results.

This way, both automated jobs and human teams work with the least privilege needed. Clear role boundaries stop small pipeline bugs from turning into major database outages.

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

Should Dataflow jobs use the default postgres admin user in Cloud SQL?

No, Dataflow jobs should never use the default admin user to run pipeline queries. Create a separate database user with only the table rights that specific job needs.

Can I give a Dataflow database user full superuser rights in Cloud SQL?

No, Cloud SQL is a managed service and does not give customers superuser attributes. If a job needs replication rights, assign a dedicated role built for replication tasks.

How do we protect sensitive records when engineers debug failed Dataflow runs?

Give engineers separate read roles and apply masking to rewrite emails and card numbers. Keep all human debug queries separate from the service accounts that run your pipelines.

The query runs. The emails stay hidden.