CertSafari
    Databricks Certified Data Analyst Associate· Lessons

    Domain 4 · Lesson 11/39

    Lakehouse Federation: joining Delta tables with external databases

    Querying cross-system analytics by joining data from a Delta table and a federated data source.

    15 min read
    2.22% of exam
    7 sources
    Published 22 Oct 2026
    Docs as of 17 Oct 2026

    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.

    Querying in place compared with the ingestion options
    ApproachWhat happens to the dataBest for
    Query federation (Lakehouse Federation)Stays in the external database; queries are pushed down using JDBCAd hoc reporting, proof-of-concept work, supporting workloads during incremental migration
    Lakeflow Connect managed connectorsIngested into DatabricksHigh data volumes and lower query latency
    Query-based ingestion connectorsCopied on a schedule using a cursor column, without a gateway or staging storageRecurring 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.

    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?

    Sources123

    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.

    A PostgreSQL connection that reads its credentials from Databricks secrets instead of plaintext stringssql
    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.

    Mirroring a PostgreSQL database as a foreign catalog through an existing connectionsql
    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.

    Who can set up federation, and on what compute
    RequirementRule
    Create a connectionMetastore 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 catalogCREATE CATALOG on the metastore, plus ownership of the connection or the CREATE FOREIGN CATALOG privilege on the connection
    SQL warehousePro or serverless, version 2023.40 or above
    ClustersDatabricks 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?

    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?

    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?

    Sources21

    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.

    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?

    Sources4526

    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.

    Pushdown operations supported for PostgreSQL
    OperationPushed down on
    FiltersAll compute
    ProjectionsAll compute
    Limit and OffsetAll compute
    AggregatesAll compute
    Sorting, when used with limitAll compute
    JoinsDatabricks Runtime 17.2 and above and SQL warehouse compute; Public Preview, requires the Join Pushdown for Federated Queries toggle
    Window functionsNot 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?

    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?

    Sources27

    Sources

    (7)

    Every claim above is drawn from one of these pages, quoted as it was written on the date shown.

    1. 1.
      “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. 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. 3.
      “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. 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. 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. 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. 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

    Spotted a mistake, or was something unclear? Tell us.