Skip to content

Commit

Permalink
fix BigQuery SQL backticks
Browse files Browse the repository at this point in the history
  • Loading branch information
gouline committed Dec 20, 2024
1 parent d6a4247 commit 98ce6f9
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions dbtmetabase/_exposures.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,11 @@ def __extract_card_exposures(self, ctx: __Context, card: Mapping) -> Mapping:

# Parse SQL for exposures through FROM or JOIN clauses
for sql_ref in re.findall(_EXPOSURE_PARSER, native_query):
if "`" in sql_ref:
print(">>>", sql_ref)
sql_ref = sql_ref.strip("`") # BigQuery uses backticks `dataset.table`
print(">>>>", sql_ref)

# DATABASE.schema.table -> [database, schema, table]
parsed_model_path = [s.strip('"').lower() for s in sql_ref.split(".")]

Expand Down

0 comments on commit 98ce6f9

Please sign in to comment.