Skip to content

Commit 7b9751f

Browse files
committed
Merge branch 'm-kovalsky/093'
2 parents 80642ba + d29b0e8 commit 7b9751f

File tree

7 files changed

+23
-28
lines changed

7 files changed

+23
-28
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Semantic Link Labs
22

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

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

121121
## Version History
122+
* [0.9.3](https://github.com/microsoft/semantic-link-labs/releases/tag/0.9.3) (February 13, 2025)
122123
* [0.9.2](https://github.com/microsoft/semantic-link-labs/releases/tag/0.9.2) (February 5, 2025)
123124
* [0.9.1](https://github.com/microsoft/semantic-link-labs/releases/tag/0.9.1) (January 22, 2025)
124125
* [0.9.0](https://github.com/microsoft/semantic-link-labs/releases/tag/0.9.0) (January 22, 2025)

docs/source/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
project = 'semantic-link-labs'
1414
copyright = '2024, Microsoft and community'
1515
author = 'Microsoft and community'
16-
release = '0.9.2'
16+
release = '0.9.3'
1717

1818
# -- General configuration ---------------------------------------------------
1919
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ name="semantic-link-labs"
77
authors = [
88
{ name = "Microsoft Corporation" },
99
]
10-
version="0.9.2"
10+
version="0.9.3"
1111
description="Semantic Link Labs for Microsoft Fabric"
1212
readme="README.md"
1313
requires-python=">=3.10,<3.12"

src/sempy_labs/_delta_analyzer.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,11 @@ def delta_analyzer(
6363
"""
6464
import notebookutils
6565

66-
display_toggle = notebookutils.common.configs.pandas_display
66+
# display_toggle = notebookutils.common.configs.pandas_display
6767

6868
# Turn off notebookutils display
69-
if display_toggle is True:
70-
notebookutils.common.configs.pandas_display = False
69+
# if display_toggle is True:
70+
# notebookutils.common.configs.pandas_display = False
7171

7272
prefix = "SLL_DeltaAnalyzer_"
7373
now = datetime.datetime.now()
@@ -93,7 +93,7 @@ def delta_analyzer(
9393
table_path = f"{local_path}/Tables/{table_name}"
9494

9595
# Set back to original value
96-
notebookutils.common.configs.pandas_display = display_toggle
96+
# notebookutils.common.configs.pandas_display = display_toggle
9797

9898
parquet_file_df_columns = {
9999
"ParquetFile": "string",
@@ -247,15 +247,15 @@ def delta_analyzer(
247247
table_name=table_name,
248248
column_name=col_name,
249249
function="approx",
250-
lakehouse=lakehouse_name,
250+
lakehouse=lakehouse,
251251
workspace=workspace,
252252
)
253253
else:
254254
dc = _get_column_aggregate(
255255
table_name=table_name,
256256
column_name=col_name,
257257
function="distinctcount",
258-
lakehouse=lakehouse_name,
258+
lakehouse=lakehouse,
259259
workspace=workspace,
260260
)
261261

@@ -288,7 +288,7 @@ def delta_analyzer(
288288
runId = 1
289289
else:
290290
max_run_id = _get_column_aggregate(
291-
lakehouse=lakehouse_name, table_name=save_table
291+
table_name=save_table,
292292
)
293293
runId = max_run_id + 1
294294

src/sempy_labs/_helper_functions.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,8 @@ def save_as_delta_table(
544544
f"{icons.red_dot} Invalid 'delta_table_name'. Delta tables in the lakehouse cannot have spaces in their names."
545545
)
546546

547-
dataframe.columns = dataframe.columns.str.replace(" ", "_")
547+
dataframe.columns = [col.replace(" ", "_") for col in dataframe.columns]
548+
548549
spark = _create_spark_session()
549550

550551
type_mapping = {
@@ -1617,7 +1618,7 @@ def _create_spark_session():
16171618
return SparkSession.builder.getOrCreate()
16181619

16191620

1620-
def _read_delta_table(path: str) -> pd.DataFrame:
1621+
def _read_delta_table(path: str):
16211622

16221623
spark = _create_spark_session()
16231624

src/sempy_labs/_model_bpa_rules.py

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,7 @@ def model_bpa_rules(
7474
"Info",
7575
"Check if dynamic row level security (RLS) is necessary",
7676
lambda obj, tom: any(
77-
re.search(
78-
pattern, obj.FilterExpression, flags=re.IGNORECASE
79-
)
77+
re.search(pattern, obj.FilterExpression, flags=re.IGNORECASE)
8078
for pattern in ["USERPRINCIPALNAME()", "USERNAME()"]
8179
),
8280
"Usage of dynamic row level security (RLS) can add memory and performance overhead. Please research the pros/cons of using it.",
@@ -253,9 +251,7 @@ def model_bpa_rules(
253251
"Warning",
254252
"Reduce usage of calculated columns that use the RELATED function",
255253
lambda obj, tom: obj.Type == TOM.ColumnType.Calculated
256-
and re.search(
257-
r"related\s*\(", obj.Expression, flags=re.IGNORECASE
258-
),
254+
and re.search(r"related\s*\(", obj.Expression, flags=re.IGNORECASE),
259255
"Calculated columns do not compress as well as data columns and may cause longer processing times. As such, calculated columns should be avoided if possible. One scenario where they may be easier to avoid is if they use the RELATED function.",
260256
"https://www.sqlbi.com/articles/storage-differences-between-calculated-columns-and-calculated-tables",
261257
),
@@ -666,9 +662,7 @@ def model_bpa_rules(
666662
"Column",
667663
"Warning",
668664
"Provide format string for 'Date' columns",
669-
lambda obj, tom: (
670-
re.search(r"date", obj.Name, flags=re.IGNORECASE)
671-
)
665+
lambda obj, tom: (re.search(r"date", obj.Name, flags=re.IGNORECASE))
672666
and (obj.DataType == TOM.DataType.DateTime)
673667
and (obj.FormatString != "mm/dd/yyyy"),
674668
'Columns of type "DateTime" that have "Month" in their names should be formatted as "mm/dd/yyyy".',
@@ -766,9 +760,7 @@ def model_bpa_rules(
766760
"Column",
767761
"Info",
768762
"Month (as a string) must be sorted",
769-
lambda obj, tom: (
770-
re.search(r"month", obj.Name, flags=re.IGNORECASE)
771-
)
763+
lambda obj, tom: (re.search(r"month", obj.Name, flags=re.IGNORECASE))
772764
and not (re.search(r"months", obj.Name, flags=re.IGNORECASE))
773765
and (obj.DataType == TOM.DataType.String)
774766
and len(str(obj.SortByColumn)) == 0,
@@ -788,9 +780,7 @@ def model_bpa_rules(
788780
"Column",
789781
"Warning",
790782
'Provide format string for "Month" columns',
791-
lambda obj, tom: re.search(
792-
r"month", obj.Name, flags=re.IGNORECASE
793-
)
783+
lambda obj, tom: re.search(r"month", obj.Name, flags=re.IGNORECASE)
794784
and obj.DataType == TOM.DataType.DateTime
795785
and obj.FormatString != "MMMM yyyy",
796786
'Columns of type "DateTime" that have "Month" in their names should be formatted as "MMMM yyyy".',

src/sempy_labs/tom/_model.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3412,7 +3412,10 @@ def create_pattern(tableList, b):
34123412
if c.Name == obj.Name:
34133413
tableList.append(c.Parent.Name)
34143414
if (
3415-
re.search(create_pattern(tableList, re.escape(obj.Name)), object.Expression)
3415+
re.search(
3416+
create_pattern(tableList, re.escape(obj.Name)),
3417+
object.Expression,
3418+
)
34163419
is not None
34173420
):
34183421
yield obj

0 commit comments

Comments
 (0)