Skip to Content
SQL Connections

SQL connections

The Query data page and the Data tabs run queries in the app. A SQL connection lets the tools you already use do the same: Power BI, Excel, Tableau, DBeaver, Metabase, psql, and anything with a PostgreSQL JDBC or ODBC driver. Classifyre answers as a PostgreSQL database: the workspace is the database, each source schema is a schema, each table you may query is a table.

  • Nothing is reachable until it is opened. A source or table is reachable through SQL connections only after its owner, a steward or an admin opens it on its Governance tab (opening a source opens all its tables). Opening gives nobody access: people still need the right to query it.
  • It names what it is for. Like Give access, a connection is for a whole source or for single tables — chosen from what is open and what you may query. Only admins and people who answer for data (owners, stewards, custodians) may make or give one for everything open.
  • It is yours. A connection belongs to one person and reads exactly what that person may query right now — their roles, their Data reader grants, the tables they own. It never gives access of its own: when a grant is removed, the connection stops reading that table at once.
  • Masks apply. Columns governance masks or hides for its person are masked or missing here too, and a masked column’s description says so (see Masked and hidden columns).
  • Row filters apply. A table that shows its readers only some rows shows the connection’s person only theirs (see Filtered rows).
  • Everything is recorded. Every table read through a connection is in the table’s Activity and Usage, with the person and the connection’s name.
  • It can be taken back. Its person or an admin can revoke it; a table’s owner can close their table to one connection; it expires.
  • No password is stored. Only a SCRAM-SHA-256 verifier is kept. The password is shown once, to its person only, and never crosses the network.

Make a connection

Open Settings → SQL connections

Choose New connection, name it after the tool (Power BI, DBeaver), choose the sources or tables it is for, and pick when it expires. From a table’s or source’s Data tab, Connect a tool → New connection for … starts with that table or source already chosen.

Copy the password

It is shown once. Lost it? New password replaces it; tools signed in with the old one stop at their next sign-in.

Connect the tool

The dialog shows the host, port, database and user, and the same as a psql line, a JDBC URL, an ODBC string and a Power BI connection string. Connect a tool next to the SQL editor shows them again at any time.

You need the right to query tables to make a connection: the Data reader role (on the workspace, a source or a table), a workspace admin role, or tables you own.

Given by an owner or admin

A table’s or source’s owner or steward can give a connection for it to someone on its Governance tab, and an admin can give one for anything. The person is notified and reveals the password themselves — the one who gave it never sees it. The connection reads only what it was given for, and only if the person may read it: an owner who wants someone to read their table also grants them access (or approves their request).

Connect your tool

Every connection uses TLS and checks the server’s certificate (sslmode=verify-full). When your installation uses its own certificate authority, download it from the connection dialog (Download the certificate authority) and point your tool at it.

psql "host=sql.example.com port=5432 dbname=finance user=ana_power_bi sslmode=verify-full sslrootcert=classifyre-sql-ca.crt"

\dn lists the schemas (<source>.<schema>), \dt "lake_finance.ledger".* their tables, \d+ shows the descriptions the table’s stewards wrote.

Naming tables

A table you see on the Query data page as source.schema.table is the PostgreSQL table "source.schema".table — the quotes are needed because of the dot. Tools quote names for you; when writing SQL by hand, set the search path once:

SET search_path = "lake_finance.ledger";
SELECT * FROM invoices WHERE amount > 1000;

Without quotes, PostgreSQL reads source.schema.table as database.schema.table and refuses it; write "source.schema".table, or "lakehouse-lab"."source.schema".table with the workspace as the database.

Tools that pool connections

Metabase, Tableau Server and application servers keep several connections open to the same database. A SQL connection allows 4 sessions at a time (sqlGateway.maxSessionsPerConnection); a pool larger than that cannot open its extra connections, and some tools then give up on all of them. Set the tool’s pool to 4 or fewer (Metabase: MB_JDBC_DATA_WAREHOUSE_MAX_CONNECTION_POOL_SIZE=4). Connections a pool opens at the same moment sign in one after the other (each waits up to 10 s for the one before it), so a pool of 4 opening at once is fine.

Everyone using such a tool reads through its one SQL connection, with its person’s access: give a shared BI tool a connection of a person (or a scope) whose access every user of that tool may have. Values the tool stores for its filters come through that connection too, masked as that person sees them.

What happens to a query

Catalog queries — the schemas, tables and columns tools read to show you what is there — are answered at once from a PostgreSQL catalog made for your session. A query that reads your tables runs exactly like one from the Query data page: the same SQL gate (one read-only statement, only the tables you may read), the same time limit, recorded per table.

  • Rows. A result has at most the workspace’s row limit (Settings → General, 10,000 by default), or its export limit if you may export (data.export). More is refused with an error, never cut silently: add a filter or a LIMIT. A result your tool reads page by page (a JDBC fetch size, a Metabase download) arrives in full.
  • Read only. INSERT, UPDATE, DELETE, MERGE, CREATE, COPY, DO blocks and the like are refused before they run, with PostgreSQL’s read-only error (25006).
  • Cursors. DECLARE … CURSOR and FETCH over your tables work as in PostgreSQL: a cursor ends with its transaction unless it is declared WITH HOLD, and one connection holds at most eight at once. Scrollable cursors, reading backward and cursors declared through a prepared statement are refused with a clear error, never answered with no rows.
  • Not served. PREPARE/EXECUTE, CREATE TABLE … AS and EXPLAIN ANALYZE over your tables are refused; tools that prepare statements through the protocol (JDBC, psqlODBC, Npgsql) are not affected.
  • Busy. When the gateway is short of memory it refuses new connections as busy rather than dropping the open ones; tools retry.
  • Cancel in your tool stops the query.
  • Mixing. One statement reads either your tables or the catalog (pg_catalog, information_schema), not both.

Speed

A query runs in the warm query worker and usually answers in about a second, like one from the Query data page. Queries that read an ODBC or custom source, and queries the worker has no room for, start a short-lived Job instead, which takes a few seconds before the query itself runs. Tools that import data (Power BI import mode, Excel, extracts in Tableau) work well with either; dashboards that send many queries at once are fastest on native sources.

Opening a source or table

On a table’s or source’s Governance tab, the Access step starts with Open to SQL connections. Its owner, a steward or an admin switches it on; a table is open when it or its source is. Settings → SQL connections lists everything open, by whom and since when. Closing it again stops every connection from reaching it at once.

Governance and activity

On a table’s or source’s Governance tab, Access lists the SQL connections that read it in the last 90 days, how often and when, whose they are, and those its scope names or that are closed on it. Its owner and stewards can:

  • give a connection for it to a person;
  • close it here for one connection — the rest of that connection keeps working, and its person is told;
  • open it again.

The table’s Activity shows each read with the connection’s name (via SQL connection Power BI), and its Usage counts the people reading it, however they read. Creating, giving, revealing, revoking and closing connections, sign-ins (at most once an hour per connection) and refused sign-ins are on the workspace’s activity too.

Who may do what

Its personOwner or steward of a table/sourceAdmin (data.connection.manage)
Open a table or source to SQL connectionsfor what they govern✓
Make one for themselves✓ for open sources/tables they may query (data.connect, a Data reader grant, or tables they own)✓, also for everything✓, also for everything
See its password✓, once per passwordnevernever
Give one to someonefor open sources and tables they governfor anything open; for everything only to an admin, owner, steward or custodian
Close a table or source to onefor what they govern✓
Revoke✓✓
See themtheir ownthose that concern their tableall

The Data reader role includes data.connect; a Data reader grant on one table lets its holders connect a tool to that table.

Making the endpoint reachable

Administrators: the endpoint is the SQL gateway, a separate service of the same image. It is on by default (Helm sqlGateway.enabled: true; the all-in-one image runs it too), but until you tell it where people reach it, the app shows a warning instead of connection details:

SQL connections are not configured yet. The SQL gateway is running, but it has no public address.

You see it on Connect a tool (which also carries a warning icon), on Settings → SQL connections and on a table’s or source’s Governance tab, each with a link to this section. Two things clear it:

  1. A public host: the name your tools connect to (sqlGateway.publicHost, or SQL_GATEWAY_PUBLIC_HOST in Docker). It is shown in the app next to every connection and put in the gateway’s certificate. sqlGateway.publicPort is the port as your tools see it (the default 5432; a NodePort’s or an entrypoint’s port otherwise).
  2. A TCP path to the gateway’s port. The gateway does its own TLS (TLS 1.3 only) and speaks the PostgreSQL protocol, so a plain HTTP Ingress or an HTTPRoute cannot carry it. Pick the row that matches your cluster:
Where it runsUsepublicHostpublicPort
A cloud cluster (EKS, GKE, AKS) or MetalLBa LoadBalancer Servicethe DNS name you point at the load balancerthe Service port (sqlGateway.port, 5432)
One node, no load balancer (k3s, a VPS)a NodePort Servicethe node’s DNS name or IPthe node port (sqlGateway.service.nodePort, 30000–32767)
Traefik v3an IngressRouteTCPthe DNS name of Traefik’s addressthe Traefik entrypoint’s port
ingress-nginxits tcp-services ConfigMapthe DNS name of the controller’s addressthe port you list there
Another TCP proxy (HAProxy, Envoy, a Gateway API TCPRoute or TLSRoute)forward TCP, passing TLS throughthe proxy’s DNS namethe proxy’s port
A laptop cluster (k3d, kind, minikube)kubectl port-forwardlocalhostthe local port you forward
Docker (all-in-one)-p 5433:5433the host of CLASSIFYRE_URL (default localhost)5433

Without a TCP-capable proxy, give the gateway its own address:

sqlGateway:
  publicHost: sql.example.com
  publicPort: 5432
  service:
    type: LoadBalancer           # or NodePort (then publicPort is the node port)
    # nodePort: 30543            # NodePort: a fixed port in 30000-32767
    loadBalancerSourceRanges: [203.0.113.0/24]
    externalTrafficPolicy: Local # keeps client addresses for allowedCidrs
  allowedCidrs: [203.0.113.0/24]

For a NodePort, set publicPort to the node port and open that port in the node’s firewall. The chart makes a certificate authority and a certificate for publicHost and keeps them across upgrades; people download the CA from the app. To use your own certificate, set sqlGateway.tls.existingSecret (a kubernetes.io/tls Secret) or let cert-manager issue one (sqlGateway.tls.certManager).

Check that it works

From a machine outside the cluster (or the Docker host), the handshake tells you whether the path is open and the certificate carries the name you set:

echo | openssl s_client -connect sql.example.com:5432 -tls1_3 -alpn postgresql 2>/dev/null | grep -E "Protocol|subject"
# Protocol: TLSv1.3
# subject=CN=sql.example.com

Then reload the app: the warning is gone and Connect a tool shows the host and port. Troubleshooting:

  • The warning stays: publicHost is empty. Check the API pod: kubectl exec deploy/classifyre-api -- printenv SQL_GATEWAY_PUBLIC_HOST.
  • Connection refused or a timeout: the port is not exposed. Check the Service type, the node’s or cloud firewall and allowedCidrs.
  • A certificate error with verify-full: the name you connect to is not the one on the certificate. After changing publicHost, delete the kept certificate so the chart makes it again (kubectl -n <namespace> delete secret <release>-sql-tls, then helm upgrade; the gateway restarts) and download the new CA.
  • Sessions refused as busy: the gateway pod is out of memory for another session; see maxSessions and the pod’s memory limit below.

Turning it off, and what it costs

If you do not want SQL connections, set sqlGateway.enabled: false: no pod, no Service, and the app says they are switched off. With it on, the gateway pod requests 250m CPU and 1 GiB (limit 4 GiB); on a small or shared node lower sqlGateway.resources.requests.

Connections use TLS 1.3 only. Other settings: maxSessions per gateway pod (each session holds a catalog of about 150 MB), maxSessionsPerConnection, idleMinutes. Ten failed sign-ins within 15 minutes lock a user name, and an address, out for 15 minutes.

Preventing direct database bypass in production

Classifyre enforces row filters, column masking, and audit logging on every query that passes through its SQL workbench, SQL gateway, and MCP server. Because Classifyre does not replace your underlying databases, production deployments enforce non-bypass operationally in two steps:

  1. Revoke direct analyst and shared BI credentials on the source systems. Analysts, BI dashboards, and AI agents authenticate only with personal, expiring Classifyre SQL connections or MCP tokens — never with raw database accounts.
  2. Restrict source network reachability to Classifyre’s service principal. Use firewall rules, VPC security groups, or Kubernetes NetworkPolicy so source database ports (e.g., PostgreSQL 5432, SQL Server 1433, Oracle 1521) accept analytical traffic exclusively from Classifyre’s dedicated query workers and application backends — never from analyst laptops, BI desktops, or AI agent hosts.

With those two controls in place, Power BI, Excel, Tableau, DBeaver, ODBC clients, and MCP AI agents have no alternative path to raw tables: every analytical read is governed, masked, and logged by Classifyre.

Last updated on