Skip to content

Commit

Permalink
leave dashboards alone
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-float-on committed Mar 14, 2024
1 parent 31a7f6a commit 7a904c7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
8 changes: 4 additions & 4 deletions dbtmetabase/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,18 +361,18 @@ 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,
output_grouping: Optional[str],
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(
Expand All @@ -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,
)


Expand Down
12 changes: 8 additions & 4 deletions dbtmetabase/_exposures.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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.
Expand Down Expand Up @@ -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 = ""
Expand Down

0 comments on commit 7a904c7

Please sign in to comment.