Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/sempy_labs/_model_bpa_bulk.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ def run_model_bpa_bulk(
workspace: Optional[str | UUID | List[str | UUID]] = None,
skip_models: Optional[str | List[str]] = ["ModelBPA", "Fabric Capacity Metrics"],
skip_models_in_workspace: Optional[dict] = None,
skip_models_with_keyword: Optional[str | List[str]] = None,
):
"""
Runs the semantic model Best Practice Analyzer across all semantic models in a workspace (or all accessible workspaces).
Expand All @@ -54,6 +55,9 @@ def run_model_bpa_bulk(
"Workspace A": ["Dataset1", "Dataset2"],
"Workspace B": ["Dataset5", "Dataset 8"],
}
skip_models_with_keyword : str | List[str], default=None
A string or list of strings to filter out semantic models with a specific keyword in the name. Not case sensitive.
For example, if you want to skip all models with the word "Test" in the name, you can set this parameter to "Test".
"""

if not lakehouse_attached():
Expand Down Expand Up @@ -104,6 +108,13 @@ def run_model_bpa_bulk(
skip_models_wkspc = skip_models_in_workspace.get(wksp)
dfD = dfD[~dfD["Dataset Name"].isin(skip_models_wkspc)]

# Skip models in workspace with keyword
if skip_models_with_keyword is not None:
if isinstance(skip_models_with_keyword, str):
skip_models_with_keyword = [skip_models_with_keyword]
for keyword in skip_models_with_keyword:
dfD = dfD[~dfD["Dataset Name"].str.contains(keyword, case=False)]

# Exclude default semantic models
if not dfD.empty:
dfI = fabric.list_items(workspace=wksp)
Expand Down