semantic-link-labs 0.9.7__py3-none-any.whl → 0.9.9__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of semantic-link-labs might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: semantic-link-labs
3
- Version: 0.9.7
3
+ Version: 0.9.9
4
4
  Summary: Semantic Link Labs for Microsoft Fabric
5
5
  Author: Microsoft Corporation
6
6
  License: MIT License
@@ -27,7 +27,7 @@ Dynamic: license-file
27
27
  # Semantic Link Labs
28
28
 
29
29
  [![PyPI version](https://badge.fury.io/py/semantic-link-labs.svg)](https://badge.fury.io/py/semantic-link-labs)
30
- [![Read The Docs](https://readthedocs.org/projects/semantic-link-labs/badge/?version=0.9.7&style=flat)](https://readthedocs.org/projects/semantic-link-labs/)
30
+ [![Read The Docs](https://readthedocs.org/projects/semantic-link-labs/badge/?version=0.9.8&style=flat)](https://readthedocs.org/projects/semantic-link-labs/)
31
31
  [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
32
32
  [![Downloads](https://static.pepy.tech/badge/semantic-link-labs)](https://pepy.tech/project/semantic-link-labs)
33
33
 
@@ -149,6 +149,7 @@ An even better way to ensure the semantic-link-labs library is available in your
149
149
  2. Select your newly created environment within the 'Environment' drop down in the navigation bar at the top of the notebook
150
150
 
151
151
  ## Version History
152
+ * [0.9.8](https://github.com/microsoft/semantic-link-labs/releases/tag/0.9.8) (April 3, 2025)
152
153
  * [0.9.7](https://github.com/microsoft/semantic-link-labs/releases/tag/0.9.7) (April 1, 2025)
153
154
  * [0.9.6](https://github.com/microsoft/semantic-link-labs/releases/tag/0.9.6) (March 12, 2025)
154
155
  * [0.9.5](https://github.com/microsoft/semantic-link-labs/releases/tag/0.9.5) (March 7, 2025)
@@ -1,4 +1,4 @@
1
- semantic_link_labs-0.9.7.dist-info/licenses/LICENSE,sha256=ws_MuBL-SCEBqPBFl9_FqZkaaydIJmxHrJG2parhU4M,1141
1
+ semantic_link_labs-0.9.9.dist-info/licenses/LICENSE,sha256=ws_MuBL-SCEBqPBFl9_FqZkaaydIJmxHrJG2parhU4M,1141
2
2
  sempy_labs/__init__.py,sha256=DCtHeonEHwZmNAmVJz_kX-a97d04NsenB-b8eK38Omo,15609
3
3
  sempy_labs/_ai.py,sha256=BD1TdGOJ7T4m3x426OP-FLb7bevn-9gKY8BTEDAJDQU,16205
4
4
  sempy_labs/_authentication.py,sha256=GjtN5XqIyWXbR5Ni4hfYiUNwgFa-ySX8e-BrqE1vgGc,6903
@@ -23,7 +23,7 @@ sempy_labs/_gateways.py,sha256=6JE6VeGFPKF617sf2mMkxXVOz57YHI5jAQLAF-BzRLc,17527
23
23
  sempy_labs/_generate_semantic_model.py,sha256=5BRdobiNJ035HShCEpEkMPN-KfqVdqzGFuR0HM346mA,18560
24
24
  sempy_labs/_git.py,sha256=RyaT4XzrSi-4NLJZWiWZnnNpMgrKzRNxhyY8b1O2I6c,17819
25
25
  sempy_labs/_graphQL.py,sha256=truXeIUPRKLwc4skhs3FZYNcKP9FCGKly9en0YkR4NE,2690
26
- sempy_labs/_helper_functions.py,sha256=Dx1B2VZdCY-X8qwDo3KZ5wE3jm1XL0jDsTqQ8F0tJks,65798
26
+ sempy_labs/_helper_functions.py,sha256=Gd3m3-X8NinBNX0MRo39NXrPSBe66NGWTmR9p164520,62666
27
27
  sempy_labs/_icons.py,sha256=SB9EQeoFCfD4bO6fcYuJOoPRSYenSrW0rI9G5RFsH28,3579
28
28
  sempy_labs/_job_scheduler.py,sha256=_-Pifkttk1oPNxewxwWcQ4QC_Hr24GSi6nmrEXwc0pc,15814
29
29
  sempy_labs/_kql_databases.py,sha256=0WVG9oiWgbjgV_oQc4f96QogqitVkbIeCmF_dVeePQE,4212
@@ -186,8 +186,8 @@ sempy_labs/report/_bpareporttemplate/definition/pages/c597da16dc7e63222a82/visua
186
186
  sempy_labs/report/_bpareporttemplate/definition/pages/d37dce724a0ccc30044b/page.json,sha256=wBVuNc8S2NaUA0FC708w6stmR2djNZp8nAsHMqesgsc,293
187
187
  sempy_labs/report/_bpareporttemplate/definition/pages/d37dce724a0ccc30044b/visuals/ce8532a7e25020271077/visual.json,sha256=mlY6t9OlSe-Y6_QmXJpS1vggU6Y3FjISUKECL8FVSg8,931
188
188
  sempy_labs/tom/__init__.py,sha256=Qbs8leW0fjzvWwOjyWK3Hjeehu7IvpB1beASGsi28bk,121
189
- sempy_labs/tom/_model.py,sha256=nHKFDh9yjTAvO96yPCsbW7ZMUPn44m8mlSElZp6ebbs,194439
190
- semantic_link_labs-0.9.7.dist-info/METADATA,sha256=pbas6wJ715KVGnLNZ4R3vk3vq3tU6tKWp_mGydHWJKs,26200
191
- semantic_link_labs-0.9.7.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
192
- semantic_link_labs-0.9.7.dist-info/top_level.txt,sha256=kiQX1y42Dbein1l3Q8jMUYyRulDjdlc2tMepvtrvixQ,11
193
- semantic_link_labs-0.9.7.dist-info/RECORD,,
189
+ sempy_labs/tom/_model.py,sha256=zA94EUofE-VolEQWrDMt1aYSL744_CgU8V8NHvxKU08,194461
190
+ semantic_link_labs-0.9.9.dist-info/METADATA,sha256=8ugBJQMVZQfhma37IkIzl_MDKHGyt1Ov3ekzSBtetkU,26294
191
+ semantic_link_labs-0.9.9.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
192
+ semantic_link_labs-0.9.9.dist-info/top_level.txt,sha256=kiQX1y42Dbein1l3Q8jMUYyRulDjdlc2tMepvtrvixQ,11
193
+ semantic_link_labs-0.9.9.dist-info/RECORD,,
@@ -65,9 +65,11 @@ def create_abfss_path(
65
65
  path = f"abfss://{lakehouse_workspace_id}@{fp}/{lakehouse_id}"
66
66
 
67
67
  if delta_table_name is not None:
68
+ path += "/Tables"
68
69
  if schema is not None:
69
- path += f"/{schema}"
70
- path += f"/Tables/{delta_table_name}"
70
+ path += f"/{schema}/{delta_table_name}"
71
+ else:
72
+ path += f"/{delta_table_name}"
71
73
 
72
74
  return path
73
75
 
@@ -392,7 +394,7 @@ def resolve_lakehouse_name_and_id(
392
394
  lakehouse: Optional[str | UUID] = None, workspace: Optional[str | UUID] = None
393
395
  ) -> Tuple[str, UUID]:
394
396
 
395
- (workspace_name, workspace_id) = resolve_workspace_name_and_id(workspace)
397
+ workspace_id = resolve_workspace_id(workspace)
396
398
  type = "Lakehouse"
397
399
 
398
400
  if lakehouse is None:
@@ -896,113 +898,6 @@ def resolve_workspace_name_and_id(
896
898
  return workspace_name, workspace_id
897
899
 
898
900
 
899
- def resolve_item_id(
900
- item: str | UUID, type: Optional[str] = None, workspace: Optional[str | UUID] = None
901
- ) -> UUID:
902
-
903
- (workspace_name, workspace_id) = resolve_workspace_name_and_id(workspace)
904
- item_id = None
905
-
906
- if _is_valid_uuid(item):
907
- # Check (optional)
908
- item_id = item
909
- try:
910
- _base_api(
911
- request=f"/v1/workspaces/{workspace_id}/items/{item_id}",
912
- client="fabric_sp",
913
- )
914
- except FabricHTTPException:
915
- raise ValueError(
916
- f"{icons.red_dot} The '{item_id}' item was not found in the '{workspace_name}' workspace."
917
- )
918
- else:
919
- if type is None:
920
- raise ValueError(
921
- f"{icons.red_dot} The 'type' parameter is required if specifying an item name."
922
- )
923
- responses = _base_api(
924
- request=f"/v1/workspaces/{workspace_id}/items?type={type}",
925
- client="fabric_sp",
926
- uses_pagination=True,
927
- )
928
- for r in responses:
929
- for v in r.get("value", []):
930
- display_name = v.get("displayName")
931
- if display_name == item:
932
- item_id = v.get("id")
933
- break
934
-
935
- if item_id is None:
936
- raise ValueError(
937
- f"{icons.red_dot} There's no item '{item}' of type '{type}' in the '{workspace_name}' workspace."
938
- )
939
-
940
- return item_id
941
-
942
-
943
- def resolve_item_name_and_id(
944
- item: str | UUID, type: Optional[str] = None, workspace: Optional[str | UUID] = None
945
- ) -> Tuple[str, UUID]:
946
-
947
- workspace_id = resolve_workspace_id(workspace)
948
- item_id = resolve_item_id(item=item, type=type, workspace=workspace_id)
949
- item_name = (
950
- _base_api(
951
- request=f"/v1/workspaces/{workspace_id}/items/{item_id}", client="fabric_sp"
952
- )
953
- .json()
954
- .get("displayName")
955
- )
956
-
957
- return item_name, item_id
958
-
959
-
960
- def resolve_item_name(item_id: UUID, workspace: Optional[str | UUID] = None) -> str:
961
-
962
- workspace_id = resolve_workspace_id(workspace)
963
- try:
964
- item_name = (
965
- _base_api(
966
- request=f"/v1/workspaces/{workspace_id}/items/{item_id}",
967
- client="fabric_sp",
968
- )
969
- .json()
970
- .get("displayName")
971
- )
972
- except FabricHTTPException:
973
- raise ValueError(
974
- f"{icons.red_dot} The '{item_id}' item was not found in the '{workspace_id}' workspace."
975
- )
976
-
977
- return item_name
978
-
979
-
980
- def resolve_lakehouse_name_and_id(
981
- lakehouse: Optional[str | UUID] = None, workspace: Optional[str | UUID] = None
982
- ) -> Tuple[str, UUID]:
983
-
984
- (workspace_name, workspace_id) = resolve_workspace_name_and_id(workspace)
985
- type = "Lakehouse"
986
-
987
- if lakehouse is None:
988
- lakehouse_id = fabric.get_lakehouse_id()
989
- lakehouse_name = fabric.resolve_item_name(
990
- item_id=lakehouse_id, type=type, workspace=workspace_id
991
- )
992
- elif _is_valid_uuid(lakehouse):
993
- lakehouse_id = lakehouse
994
- lakehouse_name = fabric.resolve_item_name(
995
- item_id=lakehouse_id, type=type, workspace=workspace_id
996
- )
997
- else:
998
- lakehouse_name = lakehouse
999
- lakehouse_id = fabric.resolve_item_id(
1000
- item_name=lakehouse, type=type, workspace=workspace_id
1001
- )
1002
-
1003
- return lakehouse_name, lakehouse_id
1004
-
1005
-
1006
901
  def _extract_json(dataframe: pd.DataFrame) -> dict:
1007
902
 
1008
903
  payload = dataframe["payload"].iloc[0]
@@ -1846,19 +1741,23 @@ def _base_api(
1846
1741
  lro_return_json: bool = False,
1847
1742
  lro_return_status_code: bool = False,
1848
1743
  ):
1849
-
1744
+ import notebookutils
1850
1745
  from sempy_labs._authentication import _get_headers
1851
1746
 
1852
1747
  if (lro_return_json or lro_return_status_code) and status_codes is None:
1853
1748
  status_codes = [200, 202]
1854
1749
 
1750
+ def get_token(audience="pbi"):
1751
+ return notebookutils.credentials.getToken(audience)
1752
+
1855
1753
  if isinstance(status_codes, int):
1856
1754
  status_codes = [status_codes]
1857
1755
 
1858
1756
  if client == "fabric":
1859
- c = fabric.FabricRestClient()
1757
+ c = fabric.FabricRestClient(token_provider=get_token)
1860
1758
  elif client == "fabric_sp":
1861
- c = fabric.FabricRestClient(token_provider=auth.token_provider.get())
1759
+ token = auth.token_provider.get() or get_token
1760
+ c = fabric.FabricRestClient(token_provider=token)
1862
1761
  elif client in ["azure", "graph"]:
1863
1762
  pass
1864
1763
  else:
sempy_labs/tom/_model.py CHANGED
@@ -5065,7 +5065,9 @@ class TOMWrapper:
5065
5065
  # Remove the Direct Lake partition
5066
5066
  self.remove_object(object=p)
5067
5067
 
5068
- print(f"{icons.green_dot} The '{table_name}' table has been converted to Import mode.")
5068
+ print(
5069
+ f"{icons.green_dot} The '{table_name}' table has been converted to Import mode."
5070
+ )
5069
5071
 
5070
5072
  def close(self):
5071
5073