PostgreSQL Connector
There are two ways to use PostgreSQL data: sample it in place with PostgresSource, or read a table into memory with read().
PostgresSource requires the relational engine (the [relational] extra), because it was carried over from before the client gained a standalone Postgres connector — the engine provides the sampler.
Installation
Sample in place with PostgresSource
tables maps the names your query uses to the names in PostgreSQL; leave it out to describe every table in the schema. The connection is yours — close it when you are done sampling. Because PostgreSQL’s own primary-key constraint is enforced by the database, Schema.from_source trusts a declared key there and skips the uniqueness scan it runs against a warehouse that does not enforce one.
Read into memory instead
Standard PG* environment variables (PGHOST, PGPORT, PGDATABASE, PGUSER, PGPASSWORD, PGSSLMODE) fill in any of host, port, dbname, user, password, sslmode you omit. A libpq conninfo string or URI also works: read("postgres", conninfo="postgresql://reader@db.example.com/analytics", table="orders").
For a Databricks Lakebase database specifically, use the Lakebase connector instead — it authenticates with a short-lived token rather than a static password.
Review the inferred schema and relationships before predicting — see Build a Schema.