catalog.schema.table. To combine rows from two tables, join them on a column they share.
Usage examples
- Cross-Schema Query: This query retrieves columns
column1andcolumn2from the tabletable_namewithin the specifiedschema_nameandcatalog_name.
- Cross-Catalog Query: This query joins tables from two different catalogs,
catalog_aandcatalog_b.
Join orders and customers from two catalogs
In the Query Editor, open a workspace where you can read both tables. Choose two catalogs in the same account and region. The names below are examples. Replace them with your own catalogs, schemas, tables, and columns. First, run each query on its own. Check that the first result includes an order ID and a customer ID, and the second includes a customer ID and a name. If either table is missing or you cannot read it, see Troubleshoot a catalog.customer_id. A LEFT JOIN keeps orders even when there is no matching customer.
Order 102 stays in the result. Its name is
NULL because customer 9 has no matching row. A matched customer can also have a missing name. To tell the difference, add c.customer_id to the SELECT list. It is NULL when the order has no match. If several customer rows match an order, the join returns one row for each match.
Limitations
- Fully Qualified Path Requirement: When performing cross-schema or cross-catalog queries, it is essential to provide the entire path, including the catalog name, schema name, and table name.
- Examples:
- Hive Catalog:
<catalog_name>.<db_name>.<table_name>
catalog_name- name of catalog specified during catalog creation in e6data - Glue Catalog:
<catalog_name>.<db_name>.<table_name>
catalog_name- name of catalog specified during catalog creation in e6data - Unity Metastore:
<unity_catalog_name>.<db_name>.<table_name>
unity_catalog_name- name of catalog which is created under Unity in Databricks
- Hive Catalog:
- Examples:
- Same Account and Region for Cross-Catalog Queries: To query tables across catalogs, the catalogs must reside within the same account and region. This limitation ensures data security and optimal performance.