Connecting to Lakebase with psql and Postgres Drivers
Who this is for:
Architecture / Concept Overview: Connecting to Lakebase with psql and Postgres Drivers
Clients connect to Lakebase through a managed PostgreSQL-compatible endpoint. All connections are TLS-encrypted and authenticated via Databricks personal access tokens or OAuth.
%%{init: {"theme":"base","themeVariables":{"background":"#0B0E14","primaryTextColor":"#E0E6ED","lineColor":"#5D6470","darkMode":true,"primaryColor":"#2E4A4A","secondaryColor":"#374151","secondaryTextColor":"#E0E6ED","tertiaryColor":"#111827","tertiaryTextColor":"#E0E6ED","edgeLabelBackground":"#1f2937"}}}%%
flowchart LR
classDef source fill:#3F4B59,stroke:#9CA3AF,stroke-width:2px,rx:8,ry:8,color:#E0E6ED
classDef ingestion fill:#5A4B36,stroke:#C9A86B,stroke-width:2px,rx:8,ry:8,color:#E0E6ED
classDef processing fill:#535072,stroke:#8E82B4,stroke-width:2px,rx:8,ry:8,color:#E0E6ED
classDef storage fill:#2E4A4A,stroke:#5FAFA8,stroke-width:2px,rx:8,ry:8,color:#E0E6ED
classDef serving fill:#3D5550,stroke:#6BB7AA,stroke-width:2px,rx:8,ry:8,color:#E0E6ED
classDef governance fill:#5A3F52,stroke:#C28BB0,stroke-width:2px,rx:8,ry:8,color:#E0E6ED
A[psql CLI] -->|TLS| D[Lakebase Endpoint]
B[Python psycopg2] -->|TLS| D
C[Node.js pg] -->|TLS| D
G[JDBC Driver] -->|TLS| D
H[Go pgx] -->|TLS| D
D -->|Auth| E[Databricks IAM]
D -->|Query| F[Lakebase Engine]
A:::source
B:::source
C:::source
G:::source
H:::source
D:::processing
E:::governance
F:::storage
*Any PostgreSQL-compatible client connects to Lakebase over TLS with Databricks-managed authentication.*
%%{init: {"theme":"base","themeVariables":{"background":"#0B0E14","primaryTextColor":"#E0E6ED","lineColor":"#5D6470","darkMode":true,"primaryColor":"#2E4A4A","secondaryColor":"#374151","secondaryTextColor":"#E0E6ED","tertiaryColor":"#111827","tertiaryTextColor":"#E0E6ED","edgeLabelBackground":"#1f2937"}}}%%
graph TD
classDef source fill:#3F4B59,stroke:#9CA3AF,stroke-width:2px,rx:8,ry:8,color:#E0E6ED
classDef ingestion fill:#5A4B36,stroke:#C9A86B,stroke-width:2px,rx:8,ry:8,color:#E0E6ED
classDef processing fill:#535072,stroke:#8E82B4,stroke-width:2px,rx:8,ry:8,color:#E0E6ED
classDef storage fill:#2E4A4A,stroke:#5FAFA8,stroke-width:2px,rx:8,ry:8,color:#E0E6ED
classDef serving fill:#3D5550,stroke:#6BB7AA,stroke-width:2px,rx:8,ry:8,color:#E0E6ED
classDef governance fill:#5A3F52,stroke:#C28BB0,stroke-width:2px,rx:8,ry:8,color:#E0E6ED
A[Connection Setup] --> B[Gather Credentials]
B --> C[Configure SSL]
C --> D[Test with psql]
D --> E[Integrate Driver]
E --> F[Set Up Connection Pool]
F --> G[Production Deployment]
A:::processing
B:::governance
C:::governance
D:::source
E:::ingestion
F:::serving
G:::storage
*Follow a progressive workflow from credential gathering to production-ready connection pooling.*
Key Terms
Prerequisites and Setup
- A Lakebase project and database already created (see Creating Your First Lakebase Project and Database)
- A Databricks personal access token or OAuth credentials
- The Lakebase connection details from the project's Connection Info panel
- Appropriate client tools installed for your language of choice
Step-by-Step Implementation
Configuration Reference
| Parameter | Description | Default |
|---|---|---|
host | Lakebase endpoint hostname | Required |
port | PostgreSQL port | 5432 |
dbname | Target database name | Required |
user | Databricks email or service principal ID | Required |
password | Personal access token or OAuth token | Required |
sslmode | TLS mode (require, verify-ca, verify-full) | require |
connect_timeout | Connection timeout in seconds | 30 |
application_name | Application identifier for monitoring | Empty |
options | Additional connection options (e.g., branch selection) | Empty |
pool.max_connections | Maximum connections in the pool (client-side) | Varies by driver |
pool.idle_timeout | Time before idle connections are closed | Varies by driver |