Skip to main content
Version: Next

Connect a SQL client

QueryFlux exposes several frontends (native wire or HTTP protocols). Point your existing client at the frontend that matches its driver, not at the backend engine directly. Routing, translation, guardrails, and query history all happen when traffic enters through QueryFlux.

This page is a connection cookbook. For protocol depth (message flows, dispatch paths, unsupported features), use the matching page under Frontends.

Defaults are configurable

Ports below are the usual defaults from config.example.yaml and frontend docs. Your deployment may differ — check queryflux.frontends.*.port in your YAML.


1. Choose a frontend​

Client familyFrontendConfig keyTypical portSQL dialect
Trino CLI, Trino JDBC, Python trino, HTTP toolsTrino HTTPtrinoHttp8080Trino
psql, Postgres JDBC/Python in simple-query modePostgreSQL wirepostgresWire5432Postgres
mysql / mariadb CLI, MySQL JDBC/PythonMySQL wiremysqlWire3306MySQL
SnowSQL, Snowflake JDBC/ODBC/Python, REST v2Snowflake HTTP + SQL API v2snowflakeHttpset in YAML (often 8443 or 8445)Snowflake
Flight SQL JDBC, ADBCArrow Flight SQLflightSql50051 (gRPC)Generic

Enable each frontend in config before connecting. Snowflake has no implicit port — you must set snowflakeHttp.port. Wire and SQL API v2 share that listener; routing distinguishes snowflakeHttp vs snowflakeSqlApi.


2. Connection recipes​

Replace localhost, usernames, and passwords with your deployment. Examples assume auth is off or uses simple static users unless noted.

Trino HTTP (trinoHttp, port 8080)​

Trino CLI

trino --server http://localhost:8080 --user dev --execute "SELECT 42"

curl

The POST below submits the statement only. Sync backends may return rows in that JSON; async-capable cluster groups return a nextUri you must poll until it disappears (see Trino HTTP).

curl -X POST http://localhost:8080/v1/statement \
-H "X-Trino-User: dev" \
-d "SELECT current_date"

Poll when the response includes nextUri (requires jq):

RESP=$(curl -s -X POST http://localhost:8080/v1/statement \
-H "X-Trino-User: dev" \
-d "SELECT current_date")
while :; do
echo "$RESP"
NEXT=$(echo "$RESP" | jq -r '.nextUri // empty')
[ -n "$NEXT" ] || break
RESP=$(curl -s -H "X-Trino-User: dev" "$NEXT")
done

Python (trino package)

from trino.dbapi import connect

conn = connect(host="localhost", port=8080, user="dev")
cur = conn.cursor()
cur.execute("SELECT 42 AS answer")
print(cur.fetchone())

JDBC (Trino driver) — host and port only; user via driver properties:

jdbc:trino://localhost:8080

What the client sends for auth: Authorization: Basic, Authorization: Bearer, or X-Trino-User (see Trino HTTP frontend).

Protocol reference: Trino HTTP.


PostgreSQL wire (postgresWire, port 5432)​

Use simple-query mode. Extended query (Parse/Bind/Execute) is not supported. QueryFlux declines SSL at the wire (N response) — connect in plaintext or terminate TLS in front of QueryFlux.

psql

psql -h localhost -p 5432 -U dev -d my_catalog -c "SELECT 1"

Python (psycopg2)

import psycopg2

conn = psycopg2.connect(host="localhost", port=5432, user="dev", dbname="my_catalog")
cur = conn.cursor()
cur.execute("SELECT 42 AS answer")
print(cur.fetchone())

JDBC (PostgreSQL driver) — disable SSL if the driver insists on TLS:

jdbc:postgresql://localhost:5432/my_catalog?user=dev&sslmode=disable&preferQueryMode=simple

What the client sends for auth: username in the startup message. Client passwords are not passed to the auth provider — with auth.provider: static and auth.required: true, queries are rejected even when the client supplies a password. Use Trino HTTP or Snowflake when password-based auth is required.

Protocol reference: PostgreSQL wire.


MySQL wire (mysqlWire, port 3306)​

QueryFlux advertises mysql_native_password and rejects client-initiated TLS. Use --ssl-mode=DISABLED (CLI) or ssl_disabled=True / useSSL=false (drivers).

mysql CLI

mysql -h 127.0.0.1 -P 3306 -u dev --ssl-mode=DISABLED -e "SELECT 1"

With a default database

mysql -h 127.0.0.1 -P 3306 -u dev -D my_catalog --ssl-mode=DISABLED

Python (mysql-connector-python)

import mysql.connector

conn = mysql.connector.connect(
host="127.0.0.1", port=3306, user="dev", ssl_disabled=True
)
cur = conn.cursor()
cur.execute("SELECT 42 AS answer")
print(cur.fetchone())

JDBC (MySQL connector)

jdbc:mysql://127.0.0.1:3306/my_catalog?user=dev&useSSL=false

What the client sends for auth: username in the handshake (password bytes are not passed to the auth provider). The same static-auth limitation as PostgreSQL wire applies — use Trino HTTP or Snowflake when password verification is required.

Protocol reference: MySQL wire.


Snowflake HTTP + SQL API v2 (snowflakeHttp)​

Both Snowflake wire and REST API v2 listen on the same port you configure. QueryFlux does not terminate TLS — use protocol=http with the Python connector to QueryFlux directly, or HTTPS to a TLS terminator in front of QueryFlux for SnowSQL and other wire clients.

SnowSQL

SnowSQL speaks HTTPS to a TLS terminator in front of QueryFlux (not plaintext to QueryFlux). Modern SnowSQL builds treat -h / -p on the command line as deprecated; use a named connection in ~/.snowsql/config with host and port. insecure_mode only disables OCSP checks and does not trust a self-signed certificate. SnowSQL has no trustStore option. To trust the terminator, set REQUESTS_CA_BUNDLE to a CA bundle that includes its certificate before you run SnowSQL. See SnowSQL configuration.

[connections.queryflux]
accountname = queryflux
username = dev
host = localhost
port = 8443
export REQUESTS_CA_BUNDLE=/path/to/ca-bundle.pem
snowsql -c queryflux -q "SELECT 42 AS answer"

For a quick local test without SnowSQL TLS setup, use the Python connector below with protocol="http".

Python (snowflake-connector-python)

import snowflake.connector

conn = snowflake.connector.connect(
account="queryflux",
user="dev",
password="secret",
host="localhost",
port=8443,
protocol="http",
database="my_catalog",
schema="my_schema",
)
cur = conn.cursor()
cur.execute("SELECT 42 AS answer")
print(cur.fetchone())

SQL API v2 (curl)

curl -X POST http://localhost:8443/api/v2/statements \
-H "Authorization: Bearer <your-token>" \
-H "Content-Type: application/json" \
-d '{"statement": "SELECT 42 AS answer", "timeout": 60}'

What the client sends for auth: wire login uses LOGIN_NAME / PASSWORD; subsequent requests use Authorization: Snowflake Token="<session-token>". REST v2 uses Authorization: Bearer <token> on every request.

Multi-instance deployments: Snowflake wire sessions are sticky to one QueryFlux process — configure load-balancer session affinity (sessionAffinityAcknowledged). See Multi-replica operations.

Protocol reference: Snowflake frontend.


Arrow Flight SQL (flightSql, port 50051)​

gRPC plaintext to QueryFlux unless you add an external TLS terminator. Catalog/schema RPCs are not implemented — run SQL via GetFlightInfo + DoGet only.

Flight SQL JDBC driver — plaintext gRPC to QueryFlux:

jdbc:arrow-flight-sql://localhost:50051/?useEncryption=false

Apache Arrow's Flight SQL JDBC driver calls CreatePreparedStatement from Statement.execute, including for plain SQL. QueryFlux does not implement that RPC, so execute fails. Statement.executeQuery uses GetFlightInfo and DoGet and does not prepare. No Flight SQL client is known to both skip prepare and accept the empty FlightInfo schema.

Python (ADBC Flight SQL driver) — QueryFlux returns an empty FlightInfo schema for statement queries today. The ADBC driver validates DoGet batch schemas against that metadata, so cur.execute(...) can fail on queries that return columns (see Flight SQL frontend).

What the client sends for auth: gRPC metadata authorization: Bearer <token> (OIDC). Basic is ignored. The session username comes from x-trino-user, and the client password is not passed to auth, so static password checks do not succeed on this frontend.

Protocol reference: Arrow Flight SQL.


3. Authentication​

Who may connect and which credential each frontend accepts are configured under auth (none, static, OIDC, LDAP). Backend identity (queryAuth) and data access (OPA) are separate — see Authentication & identity.

FrontendTypical client credential
Trino HTTPBasic, Bearer, or X-Trino-User
PostgreSQL wireStartup user only (password not verified)
MySQL wireHandshake user only (password not verified)
Snowflake wireLogin body + session token header
Snowflake SQL API v2Bearer token per request
Flight SQLBearer token (authorization); username from x-trino-user

When auth.required: true, unauthenticated queries are rejected before execution on every enabled frontend — except with auth.provider: none, which only requires a non-empty username and does not verify credentials (clients may supply any username). That combination is not an authentication boundary; use static, OIDC, or LDAP when you need verified identity. Flight SQL checks credentials on DoGet, not on GetFlightInfo: an unauthenticated GetFlightInfo still returns a ticket.


4. Limitations that break clients​

These are the most common “it works against the engine but fails against QueryFlux” causes:

TopicAffected frontendsWhat to do
TLS terminated by QueryFluxAllQueryFlux does not terminate TLS on frontends. Use plaintext to QueryFlux or put a reverse proxy in front.
Extended query / prepared statementsPostgreSQL wire, MySQL wire, Flight SQLPostgres extended query, MySQL server-side prepared statements, and Flight SQL prepare RPCs are rejected. Arrow JDBC Statement.execute prepares plain SQL and fails; Statement.executeQuery does not prepare. Trino HTTP still forwards prepared statements unless access control applies to the group.
SSL on MySQL wireMySQL--ssl-mode=DISABLED / useSSL=false / ssl_disabled=True.
SSL on PostgreSQL wirePostgreSQLWire protocol declines SSL; use sslmode=disable or external TLS.
Snowflake session stickinessSnowflake wireEnable session affinity when running multiple replicas.
Flight SQL metadata RPCsFlight SQLNo GetTables / catalogs — only statement execution RPCs.
Password auth on wire frontendsPostgreSQL wire, MySQL wire, Flight SQLClient passwords are not passed to auth. Use Trino HTTP or Snowflake for password-based auth. Flight SQL accepts a Bearer token only.

For full protocol behavior, open the linked frontend page under Frontends.


5. Verify traffic went through QueryFlux​

  1. Run a distinctive query through the frontend (for example SELECT 'via-queryflux' AS marker).
  2. Open QueryFlux Studio → Queries and confirm the query appears with the expected frontend and user.
  3. If nothing shows up, the client may be talking to a backend port instead of QueryFlux — see the warning in Route your first query.

Structured logs and Prometheus metrics also record frontend and routing decisions; see Observability.