From b7723eb442a44ce5baf993bcf760c32b6eb896a0 Mon Sep 17 00:00:00 2001 From: Mike Gouline <1960272+gouline@users.noreply.github.com> Date: Wed, 16 Oct 2024 23:25:58 +1100 Subject: [PATCH] Reference databases by dbname --- dbtmetabase/_exposures.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/dbtmetabase/_exposures.py b/dbtmetabase/_exposures.py index 08251d4..b6c951e 100644 --- a/dbtmetabase/_exposures.py +++ b/dbtmetabase/_exposures.py @@ -80,11 +80,14 @@ def extract_exposures( ctx = self.__Context( model_refs={m.alias_path.lower(): m.ref for m in models if m.ref}, - database_names={d["id"]: d["name"] for d in self.metabase.get_databases()}, + database_names={ + d["id"]: d["details"].get("dbname", d["name"]) + for d in self.metabase.get_databases() + }, table_names={ t["id"]: ".".join( [ - t.get("db", {}).get("name", ""), + t["db"]["details"].get("dbname", t["db"]["name"]), t.get("schema", DEFAULT_SCHEMA), t["name"], ]