Skip to main content
A federated query reads the tables in an external catalog by name, without first creating external tables over them. Tables in a catalog can be queried alone, joined with tables in the database, or joined with tables in other catalogs.
Federated Query Table Names
The table name rules differ by type of catalog:
  • JDBC - Both <catalog>.<database>.<schema>.<table> & <catalog>.<schema>.<table> are accepted. For a source with no schemas, such as MySQL, the name is <catalog>.<database>.<table>.
  • Apache Iceberg - The namespace may have any number of levels. A quoted part containing dots is several levels, so lake."sales.eu".orders is the same as lake.sales.eu.orders.
  • Delta Lake - The name includes the Unity Catalog catalog, unless the catalog was created with a DATABASE option naming it.
The parts of the name after the catalog are sent to the external source as written: a quoted part stays quoted, and an unquoted part is left for the source to case-convert. While a catalog is the session’s default catalog, the catalog can be left out of the name.
Querying a catalog’s tables requires READ access on the catalog and CONNECT access on its data source, and, for a data lake catalog, READ access on its credential; see GRANT Catalog Permission.

Examples

To query a table in a JDBC catalog:
Federated Query Example
To name the source’s database in the table name:
Federated Query with Database Example
To filter & aggregate a table in a JDBC catalog:
Federated Aggregation Example
To join a table in a JDBC catalog with a table in the database:
Federated/Local JOIN Example
JOIN Output
To copy a table in a catalog into a new table in the database:
Federated CREATE TABLE ... AS Example
To insert records from a table in a catalog into an existing table in the database:
Federated INSERT INTO ... SELECT Example
To create a logical view over a table in a catalog:
Federated View Example

Performance

  • All of the tables a statement reads from a catalog are described by its external source in one call per catalog, while the statement is planned.
  • Each table is loaded once per statement, even when it is referenced more than once, as in a self-join.
  • Only the columns a statement reads are loaded, and filters are passed to the external source; for a data lake table, filters are used to skip data files.
  • A part of a statement that reads only the tables of one JDBC data source is sent to that source as a single query, so its joins, aggregates, and limits are performed by the source.

Limitations

  • Tables in a catalog are read-only; INSERT, UPDATE, DELETE & MERGE statements that write to them are rejected:
    Federated UPDATE Example
    UPDATE Output
  • A materialized view over a table in a catalog is not supported; use CREATE TABLE ... AS to copy the table into the database instead:
    Federated Materialized View Example
    Materialized View Output
  • The query plans of statements that read tables in a catalog are not cached, and Apache Iceberg time travel is not supported.
  • The CURRENT_CATALOG function always returns KINETICA.