Skip to content

Commit

Permalink
fix(bigquery): add storage project name (datahub-project#5395)
Browse files Browse the repository at this point in the history
  • Loading branch information
anshbansal authored and Piotr Sierkin committed Jul 26, 2022
1 parent 23123d0 commit 5b7056d
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions metadata-ingestion/src/datahub/ingestion/source/sql/bigquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,16 +467,19 @@ def generate_profile_candidates(
profile_clause = c if c == "" else f" WHERE {c}"[:-4]
if profile_clause == "":
return None
project_id = self.get_multiproject_project_id(inspector, run_on_compute=True)
_client: BigQueryClient = BigQueryClient(project=project_id)
storage_project_id = self.get_multiproject_project_id(inspector)
exec_project_id = self.get_multiproject_project_id(
inspector, run_on_compute=True
)
_client: BigQueryClient = BigQueryClient(project=exec_project_id)
# Reading all tables' metadata to report
base_query = (
f"SELECT "
f"table_id, "
f"size_bytes, "
f"last_modified_time, "
f"row_count, "
f"FROM {schema}.__TABLES__"
f"FROM {storage_project_id}.{schema}.__TABLES__"
)
all_tables = _client.query(base_query)
report_tables: List[str] = [
Expand All @@ -499,7 +502,7 @@ def generate_profile_candidates(
f"size_bytes, "
f"last_modified_time, "
f"row_count, "
f"FROM {schema}.__TABLES__"
f"FROM {storage_project_id}.{schema}.__TABLES__"
f"{profile_clause}"
)
logger.debug(f"Profiling via {query}")
Expand Down

0 comments on commit 5b7056d

Please sign in to comment.