How multi-table operations work with SQL templates
masterDiscoverX allows you to execute a SQL template concurrently against all Delta tables matching a selection pattern. The results are returned as a single Spark DataFrame containing the union of all results.
Available SQL Template Variables
You can use the following variables within your SQL templates:
{full_table_name}: The full table name (catalog.schema.table){table_catalog}: The catalog name{table_schema}: The schema name{table_name}: The table name{stack_string_columns}: A SQL expressionstack(N, 'col1',col1, ... , 'colN',colN)for all N columns of type string{stack_all_columns_as_string}: A SQL expressionstack(N, 'col1', cast(col1AS string), ... , 'colN', cast(colNAS string))for all N columns
Common SQL Template Examples
- Describe details:
DESCRIBE DETAIL {full_table_name} - Show delta history:
SHOW HISTORY {full_table_name} - Deep clone:
CREATE TABLE IF NOT EXISTS {table_catalog}.{table_schema}_clone.{table_name} DEEP CLONE {full_table_name} - Vacuum:
VACUUM {full_table_name} - Optimize:
OPTIMIZE {full_table_name} - Tag:
ALTER TABLE {full_table_name} SET TAGS ('tag_name' = 'tag_value')