From 0efc5a4b98c636d708cb78314e5a13a5a614f6b3 Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Tue, 19 Dec 2023 19:55:23 -0500 Subject: [PATCH] remove whitespace fixes to reduce PR confusion --- dbt/adapters/spark/impl.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/dbt/adapters/spark/impl.py b/dbt/adapters/spark/impl.py index 63fe7694c..8d47ca089 100644 --- a/dbt/adapters/spark/impl.py +++ b/dbt/adapters/spark/impl.py @@ -415,10 +415,18 @@ def _get_one_catalog( raise dbt.exceptions.CompilationError( f"Expected only one schema in spark _get_one_catalog, found " f"{schemas}" ) - - relations = self.list_relations(information_schema.database, schemas.pop()) + database = information_schema.database + schema = list(schemas)[0] + relations = self.list_relations(database, schema) return self._get_relation_metadata_at_column_level(relations) + def _get_relation_metadata_at_column_level(self, relations: List[BaseRelation]) -> agate.Table: + columns: List[Dict[str, Any]] = [] + for relation in relations: + logger.debug("Getting table schema for relation {}", str(relation)) + columns.extend(self._get_columns_for_catalog(relation)) + return agate.Table.from_object(columns, column_types=DEFAULT_TYPE_TESTER) + def _get_one_catalog_by_relations( self, information_schema: InformationSchema, @@ -430,13 +438,6 @@ def _get_one_catalog_by_relations( ] return self._get_relation_metadata_at_column_level(cached_relations) - def _get_relation_metadata_at_column_level(self, relations: List[BaseRelation]) -> agate.Table: - columns: List[Dict[str, Any]] = [] - for relation in relations: - logger.debug("Getting table schema for relation {}", str(relation)) - columns.extend(self._get_columns_for_catalog(relation)) - return agate.Table.from_object(columns, column_types=DEFAULT_TYPE_TESTER) - def check_schema_exists(self, database: str, schema: str) -> bool: results = self.execute_macro(LIST_SCHEMAS_MACRO_NAME, kwargs={"database": database})