diff --git a/dbtmetabase/_exposures.py b/dbtmetabase/_exposures.py index 842a2d5..0f1eb14 100644 --- a/dbtmetabase/_exposures.py +++ b/dbtmetabase/_exposures.py @@ -98,6 +98,7 @@ def extract_exposures( exposures = [] counts: MutableMapping[str, int] = {} + all_depends = set() for collection in self.metabase.get_collections( exclude_personal=not allow_personal_collections @@ -197,6 +198,9 @@ def extract_exposures( count = counts.get(name, 0) counts[name] = count + 1 + for depend in depends: + all_depends.add(depend) + exposures.append( { "id": item["id"], @@ -229,6 +233,15 @@ def extract_exposures( self.__write_exposures(exposures, output_path, output_grouping) + with open(Path(output_path) / "depends.yaml", "w", encoding="utf-8") as f: + dump_yaml( + data={ + "models": ctx.model_refs, + "depends": list(all_depends), + }, + stream=f, + ) + return exposures def __extract_card_exposures(