How to Integrate pgAdmin and Spanner Safely

Published
Length
3 min read

Luis Felipe Dias

All posts

Teams pair pgadmin and spanner to inspect schemas and run SQL queries in production. This setup lets engineers manage cloud databases from a familiar visual client. Google Cloud Spanner offers a PostgreSQL interface for standard SQL tools. Still, standard PostgreSQL clients cannot talk to the Spanner API on their own. You must run a local translation service to bridge the two systems. Once linked, your team can browse tables, check data, and test queries. How pgadmin and spanner handle logins

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 pair pgadmin and spanner to inspect schemas and run SQL queries in production. This setup lets engineers manage cloud databases from a familiar visual client.

Google Cloud Spanner offers a PostgreSQL interface for standard SQL tools. Still, standard PostgreSQL clients cannot talk to the Spanner API on their own. You must run a local translation service to bridge the two systems. Once linked, your team can browse tables, check data, and test queries.

How pgadmin and spanner handle logins and data flow

Data flow between pgadmin and spanner relies on Google Cloud's translation adapter. This lightweight companion process runs on the engineer's machine or a shared host. It listens on a local port and speaks the standard PostgreSQL wire protocol. When pgAdmin sends a query, the adapter translates it into Spanner API calls.

Logins do not use standard database passwords stored inside the database engine. Instead, the adapter uses Google Cloud identity and role bindings to log in. You start the adapter with a user login or a service account key. Then pgAdmin connects to the local adapter port without needing a remote password. The adapter forwards the query over TLS to the cloud database instance. Spanner checks the cloud identity permissions before it returns any rows.

Not every visual feature in pgAdmin works with this cloud database backend. Spanner manages storage, backups, and server roles through cloud controls instead of SQL. Because of this, server admin tabs in pgAdmin may return unsupported errors. Engineers use the client mostly for reading tables, checking indexes, and running queries.

Common security risks and how to scope roles

The biggest risk in this setup is sharing a single service account key. Teams often deploy pgAdmin in server mode and load one strong cloud key. Every user who logs into that pgAdmin server inherits the exact same permissions. If one engineer runs a bad delete statement, cloud logs only show the shared account. You lose track of which person actually ran the query.

Broad cloud roles create another major problem for production data safety. Granting a general database admin role lets a client drop tables or change schemas. For daily debugging, engineers only need to read rows and inspect table layouts. You should create custom cloud roles that allow only select queries on specific tables. Assign those narrow roles to individual engineers instead of using shared keys.

End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Unlogged queries also put sensitive customer data at risk during support work. When an engineer queries a user table, pgAdmin pulls raw rows to their screen. Those results often contain emails, phone numbers, card numbers, or national IDs. Without query logging and field controls, teams cannot audit who viewed sensitive records.

Locking down network paths and client sessions

Network design plays a huge role in keeping your database safe. If you run the translation adapter on a shared server, lock down its port. Bind the adapter only to the local loopback address on that host. If you bind it to all network interfaces, anyone on the subnet can connect. Because the adapter already holds active cloud credentials, open ports bypass login checks.

You should also separate read-only sessions from schema change workflows. Set up default client connections with read-only roles for everyday fixing. Require a separate, tracked approval step when an engineer needs to write data. Also, apply data masking to rewrite matched fields in results for sensitive columns. This keeps emails and card numbers safe during routine table checks.

Add runtime guardrails and masking beside your databases and APIs

Login rules, role grants, and CI checks govern who connects to your stack. Yet any allowed script, engineer, or AI agent still runs commands with the full scope of its role. For workloads on Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes, SSH, or internal HTTP services, hoop.dev sits beside the service as an open-source proxy, a sidecar for your database or API.

Before a query runs, hoop.dev guardrails check the statement against your rules. An AI Analyzer you configure can score intent or hold risky calls for human review. Next, hoop.dev data masking rewrites sensitive fields in responses, and each verdict is logged per listener. Explore the MIT-licensed project on GitHub.

Frequently asked questions

Can pgAdmin connect to Spanner without an adapter?

No, pgAdmin speaks the PostgreSQL wire protocol while Spanner uses its own cloud API. You must run the Google Cloud translation service to convert traffic between them.

Does Spanner support every pgAdmin feature?

No, the database supports the PostgreSQL dialect for queries, tables, and views. System administration tabs for vacuuming, replication, and database roles do not work here.

How should teams handle credentials for shared pgAdmin servers?

Avoid placing a long-lived service account key on a shared client host. Instead, map each database session to an individual user identity and log every query.

The query runs. The emails stay hidden.