Skip to content

Commit 43e21ca

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 0775dd2 commit 43e21ca

File tree

2 files changed

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

2 files changed

+21
-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: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,30 @@ def date_function(cls):
118118
def _catalog_filter_table(
119119
cls, table: "agate.Table", used_schemas: FrozenSet[Tuple[str, str]]
120120
) -> "agate.Table":
121+
from dbt_common.clients.agate_helper import table_from_rows
122+
from dbt.adapters.base.impl import _catalog_filter_schemas
123+
121124
# On snowflake, users can set QUOTED_IDENTIFIERS_IGNORE_CASE, so force
122125
# the column names to their lowercased forms.
126+
123127
lowered = table.rename(column_names=[c.lower() for c in table.column_names])
124-
return super()._catalog_filter_table(lowered, used_schemas)
128+
129+
table = table_from_rows(
130+
lowered.rows,
131+
lowered.column_names,
132+
text_only_columns=[
133+
"table_database",
134+
"table_schema",
135+
"table_name",
136+
"table_type",
137+
"table_owner",
138+
"table_comment",
139+
"column_name",
140+
"column_type",
141+
"column_comment",
142+
],
143+
)
144+
return table.where(_catalog_filter_schemas(used_schemas))
125145

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

0 commit comments

Comments
 (0)