From 98ce6f95fad47fe155e4235f8bacd639ad589faa Mon Sep 17 00:00:00 2001 From: Mike Gouline <1960272+gouline@users.noreply.github.com> Date: Fri, 20 Dec 2024 16:04:08 +1100 Subject: [PATCH] fix BigQuery SQL backticks --- dbtmetabase/_exposures.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/dbtmetabase/_exposures.py b/dbtmetabase/_exposures.py index 1fba772..b09e2fb 100644 --- a/dbtmetabase/_exposures.py +++ b/dbtmetabase/_exposures.py @@ -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(".")]