Skip to content

Commit e715fe0

Browse files
committed
🩹 Remove table_owner from text only cols
PR #1057 added several new column names to the `text_only_columns` arg to the `table_from_rows` call in the `_catalog_filter_table` class method. This method is called as part of the `dbt docs generate` task. However, some of the new column names included are not included in the list of columns returned by certain adapter implementations for the `__get_catalog` and `__get_catalog_relations`. For example, the relevant BigQuery and Athena macros do not return a column named `table_owner` (see #1135). This results in the agate type checker emitting a warning when attempting typing checking runs. Any columns added to the `text_only_columns` argument for the call to `table_from_rows` in the base implementation should presumably be columns that are returned by all adapters implementations.
1 parent 8be7ed7 commit e715fe0

File tree

2 files changed

+20
-2
lines changed
  • dbt-adapters/src/dbt/adapters/base
  • dbt-snowflake/src/dbt/adapters/snowflake

2 files changed

+20
-2
lines changed

‎dbt-adapters/src/dbt/adapters/base/impl.py‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1329,7 +1329,6 @@ def _catalog_filter_table(
13291329
"table_name",
13301330
"table_type",
13311331
"table_comment",
1332-
"table_owner",
13331332
"column_name",
13341333
"column_type",
13351334
"column_comment",

‎dbt-snowflake/src/dbt/adapters/snowflake/impl.py‎

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,27 @@ def _catalog_filter_table(
120120
) -> "agate.Table":
121121
# On snowflake, users can set QUOTED_IDENTIFIERS_IGNORE_CASE, so force
122122
# the column names to their lowercased forms.
123+
from dbt_common.clients.agate_helper import table_from_rows
124+
from dbt.adapters.base.impl import _catalog_filter_schemas
125+
123126
lowered = table.rename(column_names=[c.lower() for c in table.column_names])
124-
return super()._catalog_filter_table(lowered, used_schemas)
127+
128+
table = table_from_rows(
129+
lowered.rows,
130+
lowered.column_names,
131+
text_only_columns=[
132+
"table_database",
133+
"table_schema",
134+
"table_name",
135+
"table_type",
136+
"table_owner",
137+
"table_comment",
138+
"column_name",
139+
"column_type",
140+
"column_comment",
141+
],
142+
)
143+
return table.where(_catalog_filter_schemas(used_schemas))
125144

126145
def _make_match_kwargs(self, database, schema, identifier):
127146
# if any path part is already quoted then consider same casing but without quotes

0 commit comments

Comments
 (0)