Skip to content

Commit

Permalink
Display bigquery subfield of record as schema. (#6522)
Browse files Browse the repository at this point in the history
Co-authored-by: Guido Petri <[email protected]>
  • Loading branch information
fukatani and guidopetri authored Oct 17, 2023
1 parent 4210808 commit ddbe0f6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions redash/query_runner/big_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,8 +301,8 @@ def get_schema(self, get_stats=False):
datasets = self._get_project_datasets(project_id)

query_base = """
SELECT table_schema, table_name, column_name
FROM `{dataset_id}`.INFORMATION_SCHEMA.COLUMNS
SELECT table_schema, table_name, field_path
FROM `{dataset_id}`.INFORMATION_SCHEMA.COLUMN_FIELD_PATHS
WHERE table_schema NOT IN ('information_schema')
"""

Expand All @@ -323,7 +323,7 @@ def get_schema(self, get_stats=False):
table_name = "{0}.{1}".format(row["table_schema"], row["table_name"])
if table_name not in schema:
schema[table_name] = {"name": table_name, "columns": []}
schema[table_name]["columns"].append(row["column_name"])
schema[table_name]["columns"].append(row["field_path"])

return list(schema.values())

Expand Down

0 comments on commit ddbe0f6

Please sign in to comment.