Lakehouse Federation lets you query tables in external databases (PostgreSQL, MySQL, Snowflake, BigQuery, and more) from Databricks without moving any data. It uses Unity Catalog CONNECTION and FOREIGN CATALOG objects to virtually map external databases into the Databricks namespace, so you can access them with ordinary SQL. The biggest advantage is bringing external data into Databricks analytics without writing any ETL.
Federation is a "don't move the data, forward the query to the external database" approach. External database tables appear to live in Databricks and are accessed through the standard three-level namespace (catalog.schema.table).
| External database | CONNECTION TYPE | Authentication | Notes |
|---|---|---|---|
| PostgreSQL | POSTGRESQL | Username / password | Allow the Databricks IP range in pg_hba.conf |
| MySQL | MYSQL | Username / password | SSL recommended |
| SQL Server | SQLSERVER | Username / password | Works with Azure SQL Database as well |
| Snowflake | SNOWFLAKE | Username / password | Specify the Snowflake account identifier |
| BigQuery | BIGQUERY | Service account JSON | Connects at the GCP project level |
| Amazon Redshift | REDSHIFT | Username / password | VPC peering or public access |
A CONNECTION is a Unity Catalog object that holds the connection details for an external database (host, port, and credentials). Creating one requires the CREATE CONNECTION privilege.
CREATE CONNECTION pg_production
TYPE POSTGRESQL
OPTIONS (
host 'prod-db.example.com',
port '5432',
user 'databricks_reader',
password SECRET('federation-scope', 'pg-password')
);CREATE CONNECTION sf_analytics
TYPE SNOWFLAKE
OPTIONS (
host 'myorg-myaccount.snowflakecomputing.com',
user 'DATABRICKS_SVC',
password SECRET('federation-scope', 'sf-password'),
sfWarehouse 'COMPUTE_WH'
);CREATE CONNECTION bq_data_warehouse
TYPE BIGQUERY
OPTIONS (
GoogleServiceAccountKeyJson SECRET('federation-scope', 'bq-sa-key')
);The cardinal rule is to use Databricks Secrets (the SECRET function) for credentials rather than hard-coding passwords in SQL. Create the Secret Scope ahead of time with commands like databricks secrets create-scope.
A FOREIGN CATALOG uses a CONNECTION to map the schemas and tables of an external database into the Unity Catalog namespace.
-- Map a PostgreSQL database as a FOREIGN CATALOG
CREATE FOREIGN CATALOG pg_catalog
USING CONNECTION pg_production
OPTIONS (database 'production_db');
-- Map a Snowflake database
CREATE FOREIGN CATALOG sf_catalog
USING CONNECTION sf_analytics
OPTIONS (database 'ANALYTICS_DB');
-- Map a BigQuery project
CREATE FOREIGN CATALOG bq_catalog
USING CONNECTION bq_data_warehouse
OPTIONS (project 'my-gcp-project');Once created, you can access these tables using the same three-level namespace as any other Unity Catalog table.
-- Query a PostgreSQL table
SELECT * FROM pg_catalog.public.customers WHERE region = 'APAC';
-- Cross-database JOIN between a Snowflake table and a local table
SELECT
c.customer_name,
o.total_amount
FROM pg_catalog.public.customers c
JOIN main.gold.orders o ON c.customer_id = o.customer_id
WHERE o.order_date >= '2026-01-01';
-- Reference a BigQuery table
SELECT * FROM bq_catalog.my_dataset.events LIMIT 100;Unity Catalog GRANT/REVOKE applies to FOREIGN CATALOG tables as well. Access is gated by two layers — the external database's native privileges and Unity Catalog privileges — so only operations allowed by both can run.
-- Grant a group usage on the FOREIGN CATALOG
GRANT USE CATALOG ON CATALOG pg_catalog TO data_analysts;
GRANT USE SCHEMA ON SCHEMA pg_catalog.public TO data_analysts;
GRANT SELECT ON TABLE pg_catalog.public.customers TO data_analysts;
-- Manage privileges on the CONNECTION
GRANT CREATE FOREIGN CATALOG ON CONNECTION pg_production TO catalog_admins;When a federated query runs, some operations are pushed down to the external database. Pushdown reduces the volume of data transferred from the external database to Databricks, which improves performance.
| Operation | Pushdown | Notes |
|---|---|---|
| WHERE-clause filters | Supported | Equality, range, IN, and similar predicates are pushed down |
| Column projection (SELECT narrowing) | Supported | Unused columns are not transferred |
| LIMIT clause | Supported | Row count is capped on the external database |
| JOIN | Not supported | Processed on the Spark side |
| GROUP BY / aggregate functions | Not supported | Processed on the Spark side |
| ORDER BY | Not supported | Sorted on the Spark side |
-- Confirm pushdown (EXPLAIN)
EXPLAIN FORMATTED
SELECT customer_id, customer_name
FROM pg_catalog.public.customers
WHERE region = 'APAC' AND created_at >= '2026-01-01';
-- If the PushedFilters section of the output shows
-- [region = 'APAC', created_at >= '2026-01-01'],
-- the filter was pushed down| Decision criterion | Federation recommended | ETL (ingest into Delta) recommended |
|---|---|---|
| Data volume | Small to medium (can be narrowed with filters) | Large (frequently querying the full dataset) |
| Query frequency | Low (ad-hoc analysis, exploratory queries) | High (scheduled reports, dashboards) |
| Freshness requirement | Real-time (always need the latest) | Batch (daily or hourly updates are sufficient) |
| Performance | External database has enough resources to spare | Need fast scans and joins |
| Write requirement | None (read-only) | Transform and persist into Delta |
[External DB: PostgreSQL / MySQL / Snowflake / BigQuery]
│
│ CONNECTION (credentials held in a Secret)
v
[FOREIGN CATALOG] -> mapped into the UC namespace
│
├── Ad-hoc analysis: query directly with SELECT ... WHERE
│ -> pushdown keeps the transferred volume small
│
└── ETL pipeline: ingest into Delta Lake on a schedule
-> materialize into a Delta table with CTAS/MERGE
-> large joins and aggregations run fast on DeltaA practical hybrid pattern is to use Federation during the exploration phase, then ingest the data that proves valuable into Delta via ETL.
Data Engineer Associate / Professional
Question 1
A data analyst wants to query a customers table in a PostgreSQL database from Databricks without copying the data, while still applying Unity Catalog access control to the external table. Which approach is best?
Correct answer: A
With Lakehouse Federation, a CONNECTION defines the connection details and a FOREIGN CATALOG maps the external database into the UC namespace. SELECT queries run without copying data, and UC GRANT/REVOKE applies. JDBC can also run queries, but UC access control would not apply. CSV export copies the data. Delta Sharing is for sharing Delta data across organizations and cannot be used to connect directly to PostgreSQL.
Can I write to an external database (INSERT/UPDATE/DELETE) through Lakehouse Federation?
No. Lakehouse Federation is read-only (SELECT only). INSERT, UPDATE, and DELETE against external databases are not supported. If you need to modify external data, use the database's native interface or build a separate write path (for example, writing directly via the JDBC driver from foreachBatch).
What exactly gets pushed down to the external database with pushdown optimization?
WHERE-clause filters, column projection (limiting which SELECT columns are returned), and LIMIT clauses are all pushed down. This reduces the volume of data transferred from the external database. More complex operations like JOIN and GROUP BY are handled on the Spark side and are not pushed down. You can verify which filters were actually pushed down with the Databricks SQL EXPLAIN statement.
Is Unity Catalog required to use Lakehouse Federation?
Yes. Lakehouse Federation relies on the Unity Catalog metastore to manage CONNECTION and FOREIGN CATALOG objects, so it is only available on workspaces with Unity Catalog enabled. The upside is that external database tables fall under the same UC access controls (GRANT/REVOKE), unifying your governance model.
Practice with certification-focused question sets
Try free questionsNicheeLab Editorial Team
NicheeLab editorial team focused on data engineering and cloud certification learning. Content is structured around practical study needs and official exam domains.
Databricks Certifications: All 7 Exams, Difficulty & Study Plan (2026)
Complete guide to all 7 Databricks certifications — Data Eng...
Databricks Exam Difficulty Ranking: All 7 Certs Compared (2026)
Every Databricks certification ranked by difficulty, with st...
Databricks Study Guide: Fastest Pass Route & Time Estimates (2026)
How to pass Databricks certifications efficiently. Official ...
Databricks Data Engineer Associate: Complete Guide (2026)
Domain-by-domain breakdown of the Databricks Certified Data ...
Databricks Data Engineer Professional: Complete Guide (2026)
Tactics for the Databricks Certified Data Engineer Professio...