Connect to VegaDB
PostgreSQL wire connectivity, TLS, client examples and the compatibility boundary.
Every VegaDB warehouse exposes a managed PostgreSQL protocol endpoint. Copy its host, port, database and user from the warehouse's Connect panel. The endpoint remains stable when the warehouse resumes, resizes or scales.
Host <warehouse endpoint shown in the console>
Port 5432
TLS required
Database your workspace database
User a user or service principalpsql
psql "host=<endpoint> port=5432 dbname=analytics user=raja sslmode=verify-full"Do not put a password in shell history. Use your organization's credential manager, the PostgreSQL password file mechanism, or a short-lived credential supplied by the Vegalake console.
Java
var url = "jdbc:postgresql://<endpoint>:5432/analytics?sslmode=verify-full";
try (var connection = DriverManager.getConnection(url, user, password);
var statement = connection.prepareStatement(
"select region, sum(amount) from sales group by region")) {
try (var rows = statement.executeQuery()) {
while (rows.next()) {
System.out.println(rows.getString(1) + ": " + rows.getBigDecimal(2));
}
}
}VegaDB verifies pgJDBC prepared statements, typed NULL, fetch-size portal suspension, arrays and nested JSONB values. Set a fetch size for a result that should be streamed rather than buffered by the driver.
Python
import psycopg
with psycopg.connect(
host="<endpoint>",
dbname="analytics",
user="service_analytics",
password="...",
sslmode="verify-full",
) as conn:
with conn.cursor() as cur:
cur.execute("select current_date, count(*) from lakehouse.events")
print(cur.fetchone())Node.js
import pg from 'pg';
const pool = new pg.Pool({
host: '<endpoint>',
port: 5432,
database: 'analytics',
user: 'service_analytics',
password: process.env.VEGADB_PASSWORD,
ssl: { rejectUnauthorized: true },
});
const result = await pool.query({
name: 'daily-revenue',
text: 'select day, sum(amount) from sales group by day order by day',
});Protocol behavior
The endpoint supports simple queries and the extended Parse/Bind/Describe/Execute flow, statement and portal close, flush, sync, cancellation and portal suspension. Results can be requested in text or supported binary encodings.
Transactions currently provide read-only READ COMMITTED blocks. Savepoints, write transactions, two-phase commit, replication, LISTEN/NOTIFY, PostgreSQL large objects and the PostgreSQL COPY protocol are not part of the supported surface.
PostgreSQL client, VegaDB SQL
The wire protocol makes drivers work. It does not change the SQL dialect. Use VegaDB data types and functions in statements even when the client library is named PostgreSQL.