Skip to content

Commit

Permalink
fixed issue 274, 277 (#278)
Browse files Browse the repository at this point in the history
* fixed issue 274, 277

* fix createpqt

* update per comment, black

* fixed warning issue
  • Loading branch information
m-kovalsky authored Nov 14, 2024
1 parent 61c49ab commit 24f0e42
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 11 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Semantic Link Labs

[![PyPI version](https://badge.fury.io/py/semantic-link-labs.svg)](https://badge.fury.io/py/semantic-link-labs)
[![Read The Docs](https://readthedocs.org/projects/semantic-link-labs/badge/?version=0.8.5&style=flat)](https://readthedocs.org/projects/semantic-link-labs/)
[![Read The Docs](https://readthedocs.org/projects/semantic-link-labs/badge/?version=0.8.6&style=flat)](https://readthedocs.org/projects/semantic-link-labs/)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![Downloads](https://static.pepy.tech/badge/semantic-link-labs)](https://pepy.tech/project/semantic-link-labs)

Expand Down Expand Up @@ -108,6 +108,7 @@ An even better way to ensure the semantic-link-labs library is available in your
2. Select your newly created environment within the 'Environment' drop down in the navigation bar at the top of the notebook

## Version History
* [0.8.6](https://github.com/microsoft/semantic-link-labs/releases/tag/0.8.6) (November 14, 2024)
* [0.8.5](https://github.com/microsoft/semantic-link-labs/releases/tag/0.8.5) (November 13, 2024)
* [0.8.4](https://github.com/microsoft/semantic-link-labs/releases/tag/0.8.4) (October 30, 2024)
* [0.8.3](https://github.com/microsoft/semantic-link-labs/releases/tag/0.8.3) (October 14, 2024)
Expand Down
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
project = 'semantic-link-labs'
copyright = '2024, Microsoft and community'
author = 'Microsoft and community'
release = '0.8.5'
release = '0.8.6'

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ name="semantic-link-labs"
authors = [
{ name = "Microsoft Corporation" },
]
version="0.8.5"
version="0.8.6"
description="Semantic Link Labs for Microsoft Fabric"
readme="README.md"
requires-python=">=3.10,<3.12"
Expand Down
14 changes: 10 additions & 4 deletions src/sempy_labs/_model_bpa_bulk.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,11 @@ def run_model_bpa_bulk(
dfD = fabric.list_datasets(workspace=wksp, mode="rest")

# Skip models in workspace
skip_models_wkspc = skip_models_in_workspace.get(wksp)
dfD = dfD[~dfD["Dataset Name"].isin(skip_models_wkspc)]
if skip_models_in_workspace is not None and isinstance(
skip_models_in_workspace, dict
):
skip_models_wkspc = skip_models_in_workspace.get(wksp)
dfD = dfD[~dfD["Dataset Name"].isin(skip_models_wkspc)]

# Exclude default semantic models
if len(dfD) > 0:
Expand Down Expand Up @@ -145,7 +148,10 @@ def run_model_bpa_bulk(

bpa_df["RunId"] = bpa_df["RunId"].astype("int")

df = pd.concat([df, bpa_df], ignore_index=True)
if df.empty:
df = bpa_df
if not bpa_df.empty:
df = pd.concat([df, bpa_df], ignore_index=True)
print(
f"{icons.green_dot} Collected Model BPA stats for the '{dataset_name}' semantic model within the '{wksp}' workspace."
)
Expand All @@ -160,7 +166,7 @@ def run_model_bpa_bulk(
f"{icons.yellow_dot} No BPA results to save for the '{wksp}' workspace."
)
else:
df["Severity"].replace(icons.severity_mapping)
df["Severity"].replace(icons.severity_mapping, inplace=True)

# Append save results individually for each workspace (so as not to create a giant dataframe)
print(
Expand Down
4 changes: 3 additions & 1 deletion src/sempy_labs/_model_dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,9 @@ def get_model_calc_dependencies(
# Initialize dependency DataFrame with 'Done' status
df = dep.copy()
objs = {"Measure", "Calc Column", "Calculation Item", "Calc Table"}
df["Done"] = df["Referenced Object Type"].apply(lambda x: x not in objs)
df["Done"] = (
df["Referenced Object Type"].apply(lambda x: x not in objs).astype(bool)
)
# Expand dependencies iteratively
while not df["Done"].all():
incomplete_rows = df[df["Done"] == False]
Expand Down
6 changes: 4 additions & 2 deletions src/sempy_labs/migration/_create_pqt_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,8 @@ def obj_to_dict(obj):
a = 0
for t_map in table_chunks:
if a > 0:
file_name = f"{file_name}_{a}"
save_file_name = f"{file_name}_{a}"
else:
save_file_name = file_name
a += 1
create_pqt(t_map, expr_map, file_name=file_name)
create_pqt(t_map, expr_map, file_name=save_file_name)
2 changes: 1 addition & 1 deletion src/sempy_labs/tom/_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -2278,7 +2278,7 @@ def is_field_parameter(self, table_name: str):
t = self.model.Tables[table_name]

return (
self.is_field_parameter(table_name=table_name)
self.is_calculated_table(table_name=table_name)
and t.Columns.Count == 4
and any(
"NAMEOF(" in p.Source.Expression.replace(" ", "") for p in t.Partitions
Expand Down

0 comments on commit 24f0e42

Please sign in to comment.