What you will be able to do
- Choose Lakehouse Federation over ingestion, Delta Sharing or file loading when external data must be queried in place
- Create a connection and a foreign catalog in the right order, with the privileges and compute each step needs
- Write a join between a local Delta table and a foreign-catalog table, knowing the read-only and access rules that apply
- Identify which operations are pushed down to the external database and verify pushdown with Query Profile or EXPLAIN FORMATTED
Key concept
Foreign catalog — A Unity Catalog catalog that mirrors one database in an external system, such as PostgreSQL or Snowflake. You can address its tables like any other table in a SQL query, but you can only read from them, and Databricks pushes as much of the work as it can to the external database.
1.Querying external databases in place
Cross-system analytics starts with data that lives in different places. Sales transactions might sit in a Delta table while daily inventory counts stay in an operational PostgreSQL database and customer accounts live in Snowflake. Lakehouse Federation lets one SQL statement read all three without copying the external rows into Databricks first. When a query touches an external table, Databricks sends the query down to that database over JDBC. Part of the query runs in Databricks and part runs on the remote system's compute.
Query federation works with MySQL, PostgreSQL, Teradata, Oracle, Amazon Redshift, Salesforce Data 360, Snowflake, Microsoft SQL Server, Azure Synapse, Google BigQuery and other Databricks workspaces. It is the right tool when you don't want to ingest the data, when you want the external system's compute to do part of the work, and when you still want Unity Catalog governance over the external tables: fine-grained access control, lineage and search. Typical uses are on-demand reporting, proof-of-concept work, exploring a source before you build an ETL pipeline, and keeping workloads running during an incremental migration.
Federation is not the default for heavy, recurring workloads. Databricks recommends Lakeflow Connect managed connectors, which copy source records into Databricks, when you need high data volumes and low query latency. The rule of thumb: use federation for ad hoc reporting and POC work, and use ingestion when the same external data feeds production queries every day.
| Approach | What happens to the data | Best for |
|---|---|---|
| Query federation (Lakehouse Federation) | Stays in the external database; queries are pushed down using JDBC | Ad hoc reporting, proof-of-concept work, supporting workloads during incremental migration |
| Lakeflow Connect managed connectors | Ingested into Databricks | High data volumes and lower query latency |
| Query-based ingestion connectors | Copied on a schedule using a cursor column, without a gateway or staging storage | Recurring ingestion when no CDC infrastructure is available |
Two other features sound similar but solve different problems. Delta Sharing is an open protocol for sharing live Delta Lake and Parquet data outward with other platforms. Data flows from a provider to recipients, so it can't pull an external database into your query. Auto Loader belongs with the other approaches for bringing data into Databricks. It handles files arriving in storage, which makes it ingestion, not querying in place.
Checkpoint 1 of 8· Match them up
Match each scenario to the approach Databricks recommends for it
Tap a term, then the definition that fits it.
Federation leaves the data in place and fits ad hoc reporting and POC work. Recurring, high-volume production use calls for ingestion: managed connectors for scale and latency, or query-based connectors when no CDC is available.
“you have a choice between managed ingestion connectors and query federation, choose query federation for ad hoc reporting or proof-of-concept work on your ETL pipelines.”Source: docs.databricks.com
Checkpoint 2 of 8· Exam question
A data analyst wants to run a single query that joins a Databricks-managed Delta table with a table that lives in an external Snowflake database, without first copying the Snowflake data into Databricks. Which Databricks capability enables this?
Correct answer: A — Lakehouse Federation, which registers the external database as a foreign catalog in Unity Catalog and pushes query predicates down to the source for execution.
- A. Lakehouse Federation is correct because it mirrors the external database as a foreign catalog inside Unity Catalog, letting a single query join it against a Delta table while pushing filters and joins toward the source system where possible.
- B. Delta Sharing is incorrect because it is designed for sharing Delta table data out to other organizations, not for querying a live external database like Snowflake from inside Databricks.
- C. Auto Loader is incorrect because it ingests new files arriving in cloud object storage into Delta tables; it has no mechanism for reaching into a running external database at query time.
- D. Lakeflow Connect is incorrect here because it copies source data into Databricks on a schedule or continuously, which is a data-movement pattern rather than the live, no-copy cross-system join the scenario asks for.
2.Creating the connection, then the foreign catalog
Federated access to an external database needs two securable objects in Unity Catalog, created in this order. The connection comes first. It records the path to the external system (host and port) and the credentials Databricks uses to log in. You create it in Catalog Explorer or with CREATE CONNECTION in a notebook or the SQL editor. The options depend on the connection type.
CREATE CONNECTION <connection-name> TYPE postgresql
OPTIONS (
host '<hostname>',
port '<port>',
user secret ('<secret-scope>','<secret-key-user>'),
password secret ('<secret-scope>','<secret-key-password>')
)The foreign catalog comes second, and it needs an existing connection. It mirrors one database from the external system. The database option names the database, except for MySQL, which uses a two-layer namespace. The foreign catalog has no host and no password of its own because it gets its credentials from the connection. In Catalog Explorer, the create-connection flow continues straight into creating the foreign catalog. Databricks syncs the catalog's metadata into Unity Catalog each time you interact with it, so new tables in the source appear without any extra step.
CREATE FOREIGN CATALOG [IF NOT EXISTS] <catalog-name> USING CONNECTION <connection-name>
OPTIONS (database '<database-name>');Lakehouse Federation has a second type, catalog federation. It connects to external catalogs such as a Hive metastore, AWS Glue or Snowflake and reads their tables directly from object storage. Its setup adds a storage credential and an external location for the table paths. Federating a database through JDBC needs neither, so an external location is never the first step for querying PostgreSQL.
| Requirement | Rule |
|---|---|
| Create a connection | Metastore admin, or the CREATE CONNECTION privilege on the metastore (workspace admins have it by default in workspaces enabled for Unity Catalog automatically) |
| Create a foreign catalog | CREATE CATALOG on the metastore, plus ownership of the connection or the CREATE FOREIGN CATALOG privilege on the connection |
| SQL warehouse | Pro or serverless, version 2023.40 or above |
| Clusters | Databricks Runtime 13.3 LTS or above, Standard or Dedicated access mode |
The compute rule matters for analysts who work in Databricks SQL. The SQL warehouse that runs your queries must be pro or serverless, so a classic warehouse can't run federated queries. Either a pro or a serverless warehouse works, and the compute also needs network connectivity to the target database.
Checkpoint 3 of 8· Check yourself
An analyst wants to query an on-premises PostgreSQL database from Databricks SQL and has no federation objects set up yet. Which setup works?
The connection comes first and holds both the path and the credentials. The foreign catalog is built on that existing connection and gets its credentials from it. A storage credential and an external location belong to catalog federation, not to JDBC database federation.
“Access credentials for the foreign catalog come from the named connection, so you don't specify them here.”Source: docs.databricks.com
Checkpoint 4 of 8· Check yourself
A team's federated query fails because it runs on a classic SQL warehouse. Which change meets the compute requirement for Lakehouse Federation?
Federation needs a pro or serverless SQL warehouse at version 2023.40 or above. Either type works. A classic warehouse is excluded whatever its version, and privileges don't change the compute requirement.
“SQL warehouses must be pro or serverless and must use 2023.40 or above.”Source: docs.databricks.com
Checkpoint 5 of 8· Exam question
An analyst at a retail company needs to set up federated access to an on-premises PostgreSQL database that stores daily inventory counts, so analysts can join it against a Delta table of sales transactions in Databricks SQL. What is the first object they must create in Unity Catalog before they can query the PostgreSQL tables?
Correct answer: A — A connection object that stores the PostgreSQL host, port, and authentication secrets, created with CREATE CONNECTION ... TYPE postgresql.
- A. Creating a connection first is correct because Lakehouse Federation requires a securable connection object holding the host, port, and credentials before any foreign catalog can be built on top of it.
- B. This is incorrect because
CREATE FOREIGN CATALOGalways references an existing connection by name viaUSING CONNECTION; it cannot embed host and credential details inline instead of a connection. - C. An external location and storage credential secure access to cloud object storage such as S3 or ADLS; they have no role in connecting to a running PostgreSQL database engine.
- D. A Delta Sharing recipient profile governs outbound sharing of Databricks data to external parties, which is the opposite direction of pulling data from PostgreSQL into a federated query.
3.Joining a Delta table to a foreign table
A foreign catalog places the external database in the Unity Catalog three-level namespace, so you address its tables as catalog.schema.table, the same way you address a local Delta table. A cross-system join therefore uses ordinary join syntax with each side qualified by its own catalog. For example: SELECT s.store_id, s.amount, i.on_hand FROM main.sales.transactions s JOIN pg_inventory.public.daily_counts i ON s.sku = i.sku. You can use any join type across local and foreign relations. Write literals and casts with Apache Spark data types, not the external database's own types. Each connector documents how its types map to Spark types.
The foreign side of the join is read-only. You can select, filter, aggregate and join foreign tables, but you can't write to them. Query federation has no write support. The only exception is federating a workspace's legacy Hive metastore through catalog federation. To keep the result of a cross-system join, write it on the Databricks side. Databricks recommends query federation as the way to load external data into a materialized view.
Access to foreign tables is granted with Unity Catalog privileges at the catalog, schema or table level, the same as for any other securable. Lineage for foreign tables is tracked the same way as for standard tables. The access mode of the compute adds one rule. On dedicated access mode compute, you must own the underlying connection to query a foreign catalog, and having the CREATE FOREIGN CATALOG privilege isn't enough. On standard access mode and serverless compute, the normal catalog privileges apply. A separate privilege, USE CONNECTION, applies to the remote_query function. That function sends SQL written in the remote database's own dialect through a connection and skips the foreign catalog.
On dedicated access mode compute, only the owner of the underlying connection can query the foreign catalog. On serverless and standard access mode compute, the normal table privileges are enough, which is why the warehouse succeeds.
Checkpoint 6 of 8· Check yourself
After joining a Delta sales table to pg_inventory.public.daily_counts, an analyst wants to keep the joined result and also correct some stock counts. What works with Lakehouse Federation?
Query federation is read-only. You can select, filter, aggregate and join foreign tables, but you can't write to them through any privilege or connection setting. A joined result you want to keep has to be written on the Databricks side, for example as a materialized view.
“It lets you run read-only queries on that data system from your Databricks workspace, and manage access using Unity Catalog.”Source: docs.databricks.com
4.Pushdown: what runs remotely, and how to check it
Pushdown decides how much data crosses the network. Query federation translates your Databricks SQL into a statement that the federated source runs itself. If a WHERE clause on the foreign table is pushed down, the remote database returns only the matching rows. If it isn't pushed down, the remote database sends every row and Databricks filters them afterwards. Each source supports a different set of pushdowns. The PostgreSQL list below is typical.
| Operation | Pushed down on |
|---|---|
| Filters | All compute |
| Projections | All compute |
| Limit and Offset | All compute |
| Aggregates | All compute |
| Sorting, when used with limit | All compute |
| Joins | Databricks Runtime 17.2 and above and SQL warehouse compute; Public Preview, requires the Join Pushdown for Federated Queries toggle |
| Window functions | Not supported |
For PostgreSQL, filters, projections and aggregates are pushed on all compute, so pushdown doesn't depend on serverless, Photon or how the connection authenticates. To find out what was actually sent, look at the generated SQL. In the graph view of the Query Profile, click the foreign data source scan node. Alternatively, run EXPLAIN FORMATTED on the query. If the filter you wrote on the Oracle or PostgreSQL table is missing from the remote statement, it wasn't pushed down, and the remote database is returning more rows than the query needs.
Every rerun of a federated query goes back to the external system. Neither the Result Cache nor the Disk Cache applies, and the use_cached_result parameter has no effect. Concurrency is limited by the Databricks SQL concurrent query limit, with no limit per connection across warehouses. A dashboard that refreshes a federated join often therefore keeps sending load to the operational database, which is another reason to switch to ingestion once a federated query becomes a production workload.
Checkpoint 7 of 8· Check yourself
In a federated join, the Databricks SQL query has WHERE region = 'EU' on a PostgreSQL foreign table, and that filter is pushed down. What does that mean for the query?
With query federation you write Databricks SQL, and Databricks translates the compatible operations and sends them to the remote database. When the filter is pushed down, PostgreSQL returns only the matching rows. For PostgreSQL, filters are pushed down on all compute, so it doesn't matter whether the warehouse is serverless or uses Photon.
“Write queries using Databricks SQL syntax. Databricks translates and pushes down compatible operations to the remote database.”Source: docs.databricks.com
Checkpoint 8 of 8· Exam question
An analyst suspects a federated query joining an Oracle foreign catalog table with a Delta table is not pushing filter predicates down to Oracle, causing it to scan far more rows than necessary. Which action lets them confirm whether pushdown actually occurred for this specific query?
Correct answer: A — Run EXPLAIN FORMATTED on the query or inspect its Query Profile to see the actual SQL statement Databricks generated and sent to the remote Oracle system.
- A.
EXPLAIN FORMATTEDand Query Profile are correct because they expose the generated remote SQL statement that Lakehouse Federation actually sends to Oracle, letting the analyst confirm whether the filter was translated into that pushed-down statement. - B. The authentication method used by a connection has no bearing on whether Databricks decides to push a given predicate down; pushdown is a query-planning decision, not a credential-type feature.
- C. Pushdown behavior for Lakehouse Federation is not restricted to serverless warehouses; switching warehouse type changes compute for local processing but does not by itself change whether predicates reach the remote system.
- D. Photon accelerates local vectorized execution inside the Databricks compute layer; it does not decide which parts of a federated query get translated and sent to the remote database engine.
Sources
(7)
Every claim above is drawn from one of these pages, quoted as it was written on the date shown.
- 1.https://docs.databricks.com/aws/en/query-federationOfficial docs
“Lakehouse Federation is the Databricks query federation platform.”
↩︎ Querying external databases in place“Create a storage credential and an external location for the table paths.”
↩︎ Creating the connection, then the foreign catalog - 2.
“query federation gets you to insights faster, because you can query the data in place and avoid complex and time-consuming ETL processing.”
↩︎ Querying external databases in place“Databricks recommends ingestion using Lakeflow Connect managed connectors because they scale to accommodate high data volumes and lower query latency.”
↩︎ Querying external databases in place“choose query federation for ad hoc reporting or proof-of-concept work on your ETL pipelines.”
↩︎ Querying external databases in place“A connection, a securable object in Unity Catalog that specifies a path and credentials for accessing an external database system.”
↩︎ Creating the connection, then the foreign catalog“you must be a metastore admin or a user with the CREATE CONNECTION privilege on the Unity Catalog metastore”
↩︎ Creating the connection, then the foreign catalog“be either the owner of the connection or have the CREATE FOREIGN CATALOG privilege on the connection”
↩︎ Creating the connection, then the foreign catalog“Foreign catalog metadata is synced into Unity Catalog on each interaction with the catalog.”
↩︎ Creating the connection, then the foreign catalog“foreign catalog creation is included and you can skip this step”
↩︎ Creating the connection, then the foreign catalog“Databricks recommends loading external data using query federation when you are creating materialized views.”
↩︎ Joining a Delta table to a foreign table“Query federation translates Databricks SQL statements into statements that can be pushed down into the federated data source.”
↩︎ Pushdown: what runs remotely, and how to check it“click the foreign data source scan node on the graph view of Query Profile, or run the EXPLAIN FORMATTED SQL statement”
↩︎ Pushdown: what runs remotely, and how to check it“Databricks query caching (Result Cache and Disk Cache) is not supported for federated queries.”
↩︎ Pushdown: what runs remotely, and how to check it“Access credentials for the foreign catalog come from the named connection, so you don't specify them here.”
↩︎ Exam trap 1“SQL warehouses must be pro or serverless and must use 2023.40 or above.”
↩︎ Exam trap 2“Databricks query caching (Result Cache and Disk Cache) is not supported for federated queries.”
↩︎ Exam trap 4“you have a choice between managed ingestion connectors and query federation, choose query federation for ad hoc reporting or proof-of-concept work on your ETL pipelines.”
↩︎ Checkpoint“Access credentials for the foreign catalog come from the named connection, so you don't specify them here.”
↩︎ Checkpoint“SQL warehouses must be pro or serverless and must use 2023.40 or above.”
↩︎ Checkpoint - 3.https://www.databricks.com/product/delta-sharingSecondary source
“It lets organizations share live data in Delta Lake and Apache Parquet formats to any data platform without copying or replicating it.”
↩︎ Querying external databases in place - 4.
“You can now issue queries across the various local and foreign relations.”
↩︎ Joining a Delta table to a foreign table“This can be done at the catalog, schema, or table level as you would do with regular securables.”
↩︎ Joining a Delta table to a foreign table - 5.
“You can run read-only queries on tables in a foreign catalog. You must use Apache Spark data types in your queries.”
↩︎ Joining a Delta table to a foreign table“On dedicated access mode compute, you must own the underlying connection to query data in the foreign catalog.”
↩︎ Joining a Delta table to a foreign table“A foreign catalog is a securable object in Unity Catalog that mirrors a database in an external data system.”
↩︎ Key concept“You can run read-only queries on tables in a foreign catalog.”
↩︎ Exam trap 3“It lets you run read-only queries on that data system from your Databricks workspace, and manage access using Unity Catalog.”
↩︎ Checkpoint - 6.
“Users need USE CONNECTION privilege on the connection.”
↩︎ Joining a Delta table to a foreign table“Write queries using Databricks SQL syntax. Databricks translates and pushes down compatible operations to the remote database.”
↩︎ Checkpoint - 7.
“The following table lists the pushdown operations supported for PostgreSQL, along with the compute required for each.”
↩︎ Pushdown: what runs remotely, and how to check it