How to Integrate Looker and Cloud SQL Safely

Published
Length
3 min read

Luis Felipe Dias

All posts

Integrating looker and cloud sql lets teams build live dashboards on managed database data. This setup runs read queries from your reporting tool against your production tables. Many teams connect these two systems with broad admin credentials to save time. That shortcut puts private customer data at risk and hides who ran which query. A safe setup needs strict database roles, private network paths, and clear audit logs. How looker and cloud sql handle logins and data flow Looker connects to

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.

Integrating looker and cloud sql lets teams build live dashboards on managed database data. This setup runs read queries from your reporting tool against your production tables.

Many teams connect these two systems with broad admin credentials to save time. That shortcut puts private customer data at risk and hides who ran which query. A safe setup needs strict database roles, private network paths, and clear audit logs.

How looker and cloud sql handle logins and data flow

Looker connects to your database by using a dedicated database user account. When a user opens a dashboard, the reporting app sends SQL queries over the network. The database checks the account credentials, runs the query, and returns the rows.

In Cloud SQL for PostgreSQL, you must manage database roles with care. Customers cannot create or use accounts with full superuser attributes in this managed service. A Google-managed system user named cloudsqladmin holds the actual superuser privileges on the database. Customers cannot delete or change Cloud SQL system roles or users.

Instead, the service gives you the cloudsqlsuperuser role, which has some high-level rights. This role can create extensions, event triggers, and replication users, publications, and subscriptions. The default admin user named postgres belongs to this cloudsqlsuperuser group by default. That default user starts without a password, so you must set one before logging in. It can create roles, create databases, and log in, but lacks superuser or replication rights.

You should never use the default admin account or cloudsqlsuperuser for your reporting tool. If a dashboard user finds a way to run custom SQL, high rights cause harm. Create a separate database user that only has read rights on specific reporting schemas.

Common failure modes and how to scope access

The biggest mistake in a reporting setup is sharing one broad service account everywhere. When every dashboard uses the same login, database logs only show that single account name. You cannot tell which analyst or viewer triggered a slow or broad query.

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

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Broad read rights also expose sensitive columns that analysts do not need for charts. Tables often hold emails, phone numbers, card numbers, or national IDs alongside order totals. If the reporting role can read the whole table, anyone building reports can query those fields. Data masking helps here by rewriting matched fields like card numbers or emails in query results.

Unlogged queries create another major blind spot for security and database teams. When a dashboard runs a bad query that locks a table, you need clear logs. Without detailed query logs, your team cannot trace the issue back to a specific user.

To fix these issues, scope your database roles down to the exact tables needed. Grant select rights only on clean reporting views or specific columns rather than raw tables. Keep your database off the public internet and route traffic over private network paths. Review your database roles often to make sure no reporting account holds admin rights.

Auditing queries and protecting sensitive fields

Good security does not stop once you set up a read-only database user. Your team also needs to watch how people query data every day. Analysts often build ad-hoc queries to test new metrics before they publish a dashboard.

Those test queries can pull millions of rows or touch tables with private user records. By turning on database audit logging, you can track every statement that hits your instance. Pair those logs with strict column controls so private fields stay safe during daily work. When you combine least-privilege roles with field masking, your reporting workflow stays fast and safe.

Check database and API queries on the wire

Identity tools, roles, and network rules decide who opens a session. Setup alone cannot check what each query does or mask sensitive values in a response once a session starts. When workflows touch Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, or internal HTTP APIs, hoop.dev runs beside those services as an open-source proxy, a sidecar for your Postgres or API. It inspects requests coming in and results going back on the wire.

Your login details and client tools stay as they are while hoop.dev guardrails refuse bad deletes or drops before they run. On responses, hoop.dev data masking rewrites matched sensitive values in memory. Furthermore, hoop.dev holds SOC 2 Type II, is MIT licensed, and writes every query and decision to an audit trail that generates evidence for HIPAA, GDPR, and PCI DSS. See the source on GitHub.

Frequently asked questions

Should I connect Looker using the default postgres user?

No, the default postgres user belongs to cloudsqlsuperuser and can create roles and databases. Create a dedicated read-only user with access to specific reporting tables instead.

Can I give my reporting tool full superuser rights in Cloud SQL?

No, customers cannot create or access users with true superuser attributes in this managed service. A system account named cloudsqladmin holds those rights, and you only need read access anyway.

How do I protect sensitive fields like emails or card numbers in reports?

Limit your reporting database role to views that leave out private columns. You can also use data masking to rewrite emails, phone numbers, and card numbers in results.

The query runs. The emails stay hidden.