diff --git a/dbtmetabase/__main__.py b/dbtmetabase/__main__.py index 9e69c85b..07530eec 100644 --- a/dbtmetabase/__main__.py +++ b/dbtmetabase/__main__.py @@ -361,10 +361,10 @@ def models( ) @click.option( "--exclude-unverified", - envvar="EXCLUDE_UNVERIFIED", + envvar="EXCLUDE_UNVERIFIED_CARDS", show_envvar=True, is_flag=True, - help="Exclude collection items that have not been verified.", + help="Exclude cards that have not been verified.", ) def exposures( output_path: str, @@ -372,7 +372,7 @@ def exposures( include_collections: Optional[Sequence[str]], exclude_collections: Optional[Sequence[str]], allow_personal_collections: bool, - exclude_unverified: bool, + exclude_unverified_cards: bool, core: DbtMetabase, ): core.extract_exposures( @@ -383,7 +383,7 @@ def exposures( exclude=exclude_collections, ), allow_personal_collections=allow_personal_collections, - exclude_unverified=exclude_unverified, + exclude_unverified_cards=exclude_unverified_cards, ) diff --git a/dbtmetabase/_exposures.py b/dbtmetabase/_exposures.py index f9c752a3..a784ffc4 100644 --- a/dbtmetabase/_exposures.py +++ b/dbtmetabase/_exposures.py @@ -46,7 +46,7 @@ def extract_exposures( output_grouping: Optional[str] = None, collection_filter: Optional[Filter] = None, allow_personal_collections: bool = False, - exclude_unverified: bool = False, + exclude_unverified_cards: bool = False, ) -> Iterable[Mapping]: """Extract dbt exposures from Metabase. @@ -55,7 +55,7 @@ def extract_exposures( output_grouping (Optional[str], optional): Grouping for output YAML files, supported values: "collection" (by collection slug) or "type" (by entity type). Defaults to None. collection_filter (Optional[Filter], optional): Filter Metabase collections. Defaults to None. allow_personal_collections (bool, optional): Allow personal Metabase collections. Defaults to False. - exlcude_unverified (bool, optional): Exclude unverified models. Defaults to False. + exclude_unverified_cards (bool, optional): Exclude unverified cards. Defaults to False. Returns: Iterable[Mapping]: List of parsed exposures. @@ -91,8 +91,12 @@ def extract_exposures( uid=collection["id"], models=("card", "dashboard"), ): - if exclude_unverified and item.get("moderated_status") != "verified": - _logger.debug("Skipping unverified item '%s'", item["id"]) + if ( + exclude_unverified_cards + and item.get("moderated_status") != "verified" + and item.get("model") == "card" + ): + _logger.debug("Skipping unverified card '%s'", item["name"]) continue depends = set() native_query = ""