@@ -291,11 +291,31 @@ def list_relations_without_caching(self, schema_relation: BaseRelation) -> t.Lis
291291 return relations
292292
293293 def get_columns_in_relation (self , relation : BaseRelation ) -> t .List [Column ]:
294- from dbt .adapters .base .column import Column
295-
296294 mapped_table = self ._map_table_name (self ._normalize (self ._relation_to_table (relation )))
295+
296+ if self .project_dialect == "bigquery" :
297+ # dbt.adapters.bigquery.column.BigQueryColumn has a different constructor signature
298+ # We need to use BigQueryColumn.create_from_field() to create the column instead
299+ if (
300+ hasattr (self .column_type , "create_from_field" )
301+ and callable (getattr (self .column_type , "create_from_field" ))
302+ and hasattr (self .engine_adapter , "get_bq_schema" )
303+ and callable (getattr (self .engine_adapter , "get_bq_schema" ))
304+ ):
305+ return [
306+ self .column_type .create_from_field (field ) # type: ignore
307+ for field in self .engine_adapter .get_bq_schema (mapped_table ) # type: ignore
308+ ]
309+ from dbt .adapters .base .column import Column
310+
311+ return [
312+ Column .from_description (
313+ name = name , raw_data_type = dtype .sql (dialect = self .project_dialect )
314+ )
315+ for name , dtype in self .engine_adapter .columns (table_name = mapped_table ).items ()
316+ ]
297317 return [
298- Column .from_description (
318+ self . column_type .from_description (
299319 name = name , raw_data_type = dtype .sql (dialect = self .project_dialect )
300320 )
301321 for name , dtype in self .engine_adapter .columns (table_name = mapped_table ).items ()
0 commit comments