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.
-- PostgreSQLのデータベースをFOREIGN CATALOGとしてマッピング
CREATE FOREIGN CATALOG pg_catalog
USING CONNECTION pg_production
OPTIONS (database 'production_db');
-- Snowflakeのデータベースをマッピング
CREATE FOREIGN CATALOG sf_catalog
USING CONNECTION sf_analytics
OPTIONS (database 'ANALYTICS_DB');
-- BigQueryのプロジェクトをマッピング
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.
-- PostgreSQLのテーブルをクエリ
SELECT * FROM pg_catalog.public.customers WHERE region = 'APAC';
-- SnowflakeのテーブルとローカルのテーブルをクロスデータベースJOIN
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';
-- BigQueryのテーブルを参照
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.
-- 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;
-- 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 |
-- プッシュダウンの確認(EXPLAIN文)
EXPLAIN FORMATTED
SELECT customer_id, customer_name
FROM pg_catalog.public.customers
WHERE region = 'APAC' AND created_at >= '2026-01-01';
-- 結果の PushedFilters セクションに
-- [region = 'APAC', created_at >= '2026-01-01'] が表示されれば
-- フィルタがプッシュダウンされている| 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 |
[外部DB: PostgreSQL / MySQL / Snowflake / BigQuery]
│
│ CONNECTION (認証情報はSecretで管理)
v
[FOREIGN CATALOG] → UC名前空間にマッピング
│
├── アドホック分析: SELECT ... WHERE で直接クエリ
│ → Pushdownで転送量を最小化
│
└── ETLパイプライン: 定期的にDelta Lakeに取り込み
→ CTAS/MERGEでDeltaテーブルにマテリアライズ
→ 大量データの結合・集約はDelta上で高速処理A 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
問題 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?
正解: 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
無料で問題を解いてみるNicheeLab 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...