Skip to content

Commit

Permalink
fix(bigquery): use get() instead of hassattr for view labels (datahub…
Browse files Browse the repository at this point in the history
…-project#10756)

Co-authored-by: Ethan Cartwright <[email protected]>
Co-authored-by: Harshal Sheth <[email protected]>
  • Loading branch information
3 people authored Jun 20, 2024
1 parent 033114d commit b3dccb0
Showing 1 changed file with 14 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ def _make_bigquery_view(view: bigquery.Row) -> BigqueryView:
materialized=view.table_type == BigqueryTableType.MATERIALIZED_VIEW,
size_in_bytes=view.get("size_bytes"),
rows_count=view.get("row_count"),
labels=parse_labels(view.labels) if hasattr(view, "labels") else None,
labels=parse_labels(view.labels) if view.get("labels") else None,
)

def get_policy_tags_for_column(
Expand Down Expand Up @@ -489,18 +489,20 @@ def get_columns_for_dataset(
comment=column.comment,
is_partition_column=column.is_partitioning_column == "YES",
cluster_column_position=column.clustering_ordinal_position,
policy_tags=list(
self.get_policy_tags_for_column(
project_id,
dataset_name,
column.table_name,
column.column_name,
report,
rate_limiter,
policy_tags=(
list(
self.get_policy_tags_for_column(
project_id,
dataset_name,
column.table_name,
column.column_name,
report,
rate_limiter,
)
)
)
if extract_policy_tags_from_catalog
else [],
if extract_policy_tags_from_catalog
else []
),
)
)

Expand Down

0 comments on commit b3dccb0

Please sign in to comment.