diff --git a/dbt/adapters/spark/impl.py b/dbt/adapters/spark/impl.py index 962a26f1e..65b036ceb 100644 --- a/dbt/adapters/spark/impl.py +++ b/dbt/adapters/spark/impl.py @@ -31,7 +31,7 @@ GET_COLUMNS_IN_RELATION_RAW_MACRO_NAME = "get_columns_in_relation_raw" LIST_SCHEMAS_MACRO_NAME = "list_schemas" LIST_RELATIONS_MACRO_NAME = "list_relations_without_caching" -LIST_RELATIONS_NO_EXTENDED_MACRO_NAME = "list_relations_without_caching_no_extended" +LIST_RELATIONS_SHOW_TABLES_MACRO_NAME = "list_relations_show_tables_without_caching" DESCRIBE_TABLE_EXTENDED_MACRO_NAME = "describe_table_extended_without_caching" DROP_RELATION_MACRO_NAME = "drop_relation" FETCH_TBL_PROPERTIES_MACRO_NAME = "fetch_tbl_properties" @@ -128,7 +128,7 @@ def add_schema_to_cache(self, schema) -> str: # so jinja doesn't render things return "" - def use_show_tables(self, table_name): + def parse_information(self, table_name): information = "" kwargs = {"table_name": table_name} try: @@ -166,7 +166,7 @@ def list_relations_without_caching( if try_show_tables: expected_result_rows = 3 try: - results = self.execute_macro(LIST_RELATIONS_NO_EXTENDED_MACRO_NAME, kwargs=kwargs) + results = self.execute_macro(LIST_RELATIONS_SHOW_TABLES_MACRO_NAME, kwargs=kwargs) except dbt.exceptions.RuntimeException as e: errmsg = getattr(e, "msg", "") description = "Error while retrieving information about" @@ -186,7 +186,7 @@ def list_relations_without_caching( if try_show_tables: _, name, _ = row - information = self.use_show_tables(name) + information = self.parse_information(name) _schema = schema_relation.schema else: _schema, name, _, information = row diff --git a/dbt/include/spark/macros/adapters.sql b/dbt/include/spark/macros/adapters.sql index 3d0406dc0..6abfc3677 100644 --- a/dbt/include/spark/macros/adapters.sql +++ b/dbt/include/spark/macros/adapters.sql @@ -218,20 +218,18 @@ {% do return(load_result('list_relations_without_caching').table) %} {% endmacro %} -{% macro list_relations_without_caching_no_extended(schema_relation) %} - {#-- We can't use temporary tables with `create ... as ()` syntax #} +{% macro list_relations_show_tables_without_caching(schema_relation) %} {#-- Spark with iceberg tables don't work with show table extended for #} {#-- V2 iceberg tables #} {#-- https://issues.apache.org/jira/browse/SPARK-33393 #} - {% call statement('list_relations_without_caching_no_extended', fetch_result=True) -%} + {% call statement('list_relations_without_caching_show_tables', fetch_result=True) -%} show tables in {{ schema_relation }} like '*' {% endcall %} - {% do return(load_result('list_relations_without_caching_no_extended').table) %} + {% do return(load_result('list_relations_without_caching_show_tables').table) %} {% endmacro %} {% macro describe_table_extended_without_caching(table_name) %} - {#-- We can't use temporary tables with `create ... as ()` syntax #} {#-- Spark with iceberg tables don't work with show table extended for #} {#-- V2 iceberg tables #} {#-- https://issues.apache.org/jira/browse/SPARK-33393 #}