From 4d0df3a8414a7477cd25ba1649f5573ed17ac199 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 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dbtmetabase/_exposures.py b/dbtmetabase/_exposures.py index 1fba772..99f6094 100644 --- a/dbtmetabase/_exposures.py +++ b/dbtmetabase/_exposures.py @@ -299,6 +299,8 @@ 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): + sql_ref = sql_ref.strip("`") # BigQuery uses backticks `dataset.table` + # DATABASE.schema.table -> [database, schema, table] parsed_model_path = [s.strip('"').lower() for s in sql_ref.split(".")]