Query federation for PostgreSQL in Databricks SQL (Experimental)

Experimental

The configurations described in this article are Experimental. Experimental features are provided as-is and are not supported by Databricks through customer technical support. To get full query federation support, you should instead use Lakehouse Federation, which enables your Databricks users to take advantage of Unity Catalog syntax and data governance tools.

This article describes how to configure read-only query federation to PostgreSQL on serverless and pro SQL warehouses.

You configure connections to PostgreSQL at the table level. You can use secrets to store and access text credentials without displaying them in plaintext. See the following example:

DROP TABLE IF EXISTS postgresql_table;
CREATE TABLE postgresql_table
USING postgresql
OPTIONS (
  dbtable '<table-name>',
  host '<database-host-url>',
  port '5432',
  database '<database-name>',
  user secret('postgres_creds', 'my_username'),
  password secret('postgres_creds', 'my_password')
);