semantic-link-labs 0.11.2__py3-none-any.whl → 0.12.0__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.
- {semantic_link_labs-0.11.2.dist-info → semantic_link_labs-0.12.0.dist-info}/METADATA +7 -6
- {semantic_link_labs-0.11.2.dist-info → semantic_link_labs-0.12.0.dist-info}/RECORD +90 -84
- sempy_labs/__init__.py +18 -18
- sempy_labs/_a_lib_info.py +1 -1
- sempy_labs/_authentication.py +81 -32
- sempy_labs/_capacities.py +2 -2
- sempy_labs/_capacity_migration.py +4 -4
- sempy_labs/_clear_cache.py +1 -1
- sempy_labs/_connections.py +107 -70
- sempy_labs/_dashboards.py +6 -2
- sempy_labs/_data_pipelines.py +1 -1
- sempy_labs/_dataflows.py +1 -1
- sempy_labs/_dax.py +3 -3
- sempy_labs/_delta_analyzer.py +4 -4
- sempy_labs/_delta_analyzer_history.py +1 -1
- sempy_labs/_deployment_pipelines.py +1 -1
- sempy_labs/_environments.py +1 -1
- sempy_labs/_eventhouses.py +9 -3
- sempy_labs/_eventstreams.py +1 -1
- sempy_labs/_external_data_shares.py +56 -2
- sempy_labs/_gateways.py +14 -7
- sempy_labs/_generate_semantic_model.py +7 -12
- sempy_labs/_git.py +1 -1
- sempy_labs/_graphQL.py +1 -1
- sempy_labs/_helper_functions.py +293 -22
- sempy_labs/_job_scheduler.py +12 -1
- sempy_labs/_kql_databases.py +1 -1
- sempy_labs/_kql_querysets.py +10 -2
- sempy_labs/_kusto.py +2 -2
- sempy_labs/_labels.py +126 -0
- sempy_labs/_list_functions.py +2 -2
- sempy_labs/_managed_private_endpoints.py +1 -1
- sempy_labs/_mirrored_databases.py +40 -16
- sempy_labs/_mirrored_warehouses.py +1 -1
- sempy_labs/_ml_experiments.py +1 -1
- sempy_labs/_model_bpa.py +6 -6
- sempy_labs/_model_bpa_bulk.py +3 -3
- sempy_labs/_model_dependencies.py +1 -1
- sempy_labs/_mounted_data_factories.py +3 -3
- sempy_labs/_notebooks.py +153 -3
- sempy_labs/_query_scale_out.py +2 -2
- sempy_labs/_refresh_semantic_model.py +1 -1
- sempy_labs/_semantic_models.py +15 -3
- sempy_labs/_spark.py +1 -1
- sempy_labs/_sql.py +3 -3
- sempy_labs/_sql_endpoints.py +5 -3
- sempy_labs/_sqldatabase.py +5 -1
- sempy_labs/_tags.py +3 -1
- sempy_labs/_translations.py +7 -360
- sempy_labs/_user_delegation_key.py +2 -2
- sempy_labs/_utils.py +27 -0
- sempy_labs/_vertipaq.py +3 -3
- sempy_labs/_vpax.py +1 -1
- sempy_labs/_warehouses.py +5 -0
- sempy_labs/_workloads.py +1 -1
- sempy_labs/_workspace_identity.py +1 -1
- sempy_labs/_workspaces.py +145 -11
- sempy_labs/admin/__init__.py +6 -0
- sempy_labs/admin/_capacities.py +34 -11
- sempy_labs/admin/_items.py +2 -2
- sempy_labs/admin/_tenant_keys.py +89 -0
- sempy_labs/directlake/_dl_helper.py +5 -2
- sempy_labs/graph/_users.py +3 -5
- sempy_labs/lakehouse/__init__.py +4 -0
- sempy_labs/lakehouse/_helper.py +18 -9
- sempy_labs/lakehouse/_lakehouse.py +18 -9
- sempy_labs/lakehouse/_materialized_lake_views.py +76 -0
- sempy_labs/lakehouse/_shortcuts.py +8 -2
- sempy_labs/migration/_migrate_calctables_to_lakehouse.py +38 -47
- sempy_labs/migration/_migrate_calctables_to_semantic_model.py +12 -22
- sempy_labs/migration/_migrate_model_objects_to_semantic_model.py +7 -11
- sempy_labs/migration/_migrate_tables_columns_to_semantic_model.py +14 -23
- sempy_labs/ml_model/__init__.py +23 -0
- sempy_labs/ml_model/_functions.py +427 -0
- sempy_labs/report/_bpareporttemplate/.pbi/localSettings.json +9 -0
- sempy_labs/report/_bpareporttemplate/.platform +11 -0
- sempy_labs/report/_download_report.py +4 -1
- sempy_labs/report/_export_report.py +12 -5
- sempy_labs/report/_generate_report.py +11 -3
- sempy_labs/report/_paginated.py +21 -15
- sempy_labs/report/_report_functions.py +19 -11
- sempy_labs/report/_report_rebind.py +21 -10
- sempy_labs/report/_reportwrapper.py +1 -1
- sempy_labs/theme/_org_themes.py +5 -6
- sempy_labs/tom/_model.py +13 -19
- sempy_labs/variable_library/__init__.py +19 -0
- sempy_labs/variable_library/_functions.py +403 -0
- sempy_labs/_dax_query_view.py +0 -57
- sempy_labs/_ml_models.py +0 -111
- sempy_labs/_variable_libraries.py +0 -92
- {semantic_link_labs-0.11.2.dist-info → semantic_link_labs-0.12.0.dist-info}/WHEEL +0 -0
- {semantic_link_labs-0.11.2.dist-info → semantic_link_labs-0.12.0.dist-info}/licenses/LICENSE +0 -0
- {semantic_link_labs-0.11.2.dist-info → semantic_link_labs-0.12.0.dist-info}/top_level.txt +0 -0
sempy_labs/_dax_query_view.py
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
from typing import Optional
|
|
2
|
-
from uuid import UUID
|
|
3
|
-
from ._helper_functions import (
|
|
4
|
-
resolve_dataset_id,
|
|
5
|
-
_get_fabric_context_setting,
|
|
6
|
-
resolve_workspace_id,
|
|
7
|
-
)
|
|
8
|
-
from sempy._utils._log import log
|
|
9
|
-
import gzip
|
|
10
|
-
import base64
|
|
11
|
-
import urllib.parse
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
@log
|
|
15
|
-
def generate_dax_query_view_url(
|
|
16
|
-
dataset: str | UUID, dax_string: str, workspace: Optional[str | UUID] = None
|
|
17
|
-
):
|
|
18
|
-
"""
|
|
19
|
-
Prints a URL based on query provided. This URL opens `DAX query view <https://learn.microsoft.com/power-bi/transform-model/dax-query-view>`_ in the Power BI service, connected to the semantic model and using the query provided.
|
|
20
|
-
|
|
21
|
-
Parameters
|
|
22
|
-
----------
|
|
23
|
-
dataset : str | uuid.UUID
|
|
24
|
-
The semantic model name or ID.
|
|
25
|
-
dax_string : str
|
|
26
|
-
The DAX query string.
|
|
27
|
-
workspace : str | uuid.UUID, default=None
|
|
28
|
-
The workspace name or ID.
|
|
29
|
-
Defaults to None which resolves to the workspace of the attached lakehouse
|
|
30
|
-
or if no lakehouse attached, resolves to the workspace of the notebook.
|
|
31
|
-
"""
|
|
32
|
-
|
|
33
|
-
workspace_id = resolve_workspace_id(workspace=workspace)
|
|
34
|
-
dataset_id = resolve_dataset_id(dataset=dataset, workspace=workspace_id)
|
|
35
|
-
|
|
36
|
-
prefix = _get_fabric_context_setting(name="spark.trident.pbienv").lower()
|
|
37
|
-
|
|
38
|
-
if prefix == "prod":
|
|
39
|
-
prefix = "app"
|
|
40
|
-
|
|
41
|
-
def gzip_base64_urlsafe(input_string):
|
|
42
|
-
# Compress the string with gzip
|
|
43
|
-
compressed_data = gzip.compress(input_string.encode("utf-8"))
|
|
44
|
-
|
|
45
|
-
# Encode the compressed data in base64
|
|
46
|
-
base64_data = base64.b64encode(compressed_data)
|
|
47
|
-
|
|
48
|
-
# Make the base64 string URL-safe
|
|
49
|
-
urlsafe_data = urllib.parse.quote_plus(base64_data.decode("utf-8"))
|
|
50
|
-
|
|
51
|
-
return urlsafe_data
|
|
52
|
-
|
|
53
|
-
formatted_query = gzip_base64_urlsafe(dax_string)
|
|
54
|
-
|
|
55
|
-
url = f"https://{prefix}.powerbi.com/groups/{workspace_id}/modeling/{dataset_id}/daxQueryView?query={formatted_query}"
|
|
56
|
-
|
|
57
|
-
print(url)
|
sempy_labs/_ml_models.py
DELETED
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
import pandas as pd
|
|
2
|
-
from typing import Optional
|
|
3
|
-
from ._helper_functions import (
|
|
4
|
-
resolve_workspace_id,
|
|
5
|
-
_base_api,
|
|
6
|
-
delete_item,
|
|
7
|
-
_create_dataframe,
|
|
8
|
-
create_item,
|
|
9
|
-
)
|
|
10
|
-
from uuid import UUID
|
|
11
|
-
from sempy._utils._log import log
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
@log
|
|
15
|
-
def list_ml_models(workspace: Optional[str | UUID] = None) -> pd.DataFrame:
|
|
16
|
-
"""
|
|
17
|
-
Shows the ML models within a workspace.
|
|
18
|
-
|
|
19
|
-
This is a wrapper function for the following API: `Items - List ML Models <https://learn.microsoft.com/rest/api/fabric/mlmodel/items/list-ml-models>`_.
|
|
20
|
-
|
|
21
|
-
Parameters
|
|
22
|
-
----------
|
|
23
|
-
workspace : str | uuid.UUID, default=None
|
|
24
|
-
The Fabric workspace name or ID.
|
|
25
|
-
Defaults to None which resolves to the workspace of the attached lakehouse
|
|
26
|
-
or if no lakehouse attached, resolves to the workspace of the notebook.
|
|
27
|
-
|
|
28
|
-
Returns
|
|
29
|
-
-------
|
|
30
|
-
pandas.DataFrame
|
|
31
|
-
A pandas dataframe showing the ML models within a workspace.
|
|
32
|
-
"""
|
|
33
|
-
|
|
34
|
-
columns = {
|
|
35
|
-
"ML Model Name": "string",
|
|
36
|
-
"ML Model Id": "string",
|
|
37
|
-
"Description": "string",
|
|
38
|
-
}
|
|
39
|
-
df = _create_dataframe(columns=columns)
|
|
40
|
-
|
|
41
|
-
workspace_id = resolve_workspace_id(workspace)
|
|
42
|
-
|
|
43
|
-
responses = _base_api(
|
|
44
|
-
request=f"/v1/workspaces/{workspace_id}/mlModels",
|
|
45
|
-
status_codes=200,
|
|
46
|
-
uses_pagination=True,
|
|
47
|
-
)
|
|
48
|
-
|
|
49
|
-
rows = []
|
|
50
|
-
for r in responses:
|
|
51
|
-
for v in r.get("value", []):
|
|
52
|
-
model_id = v.get("id")
|
|
53
|
-
modelName = v.get("displayName")
|
|
54
|
-
desc = v.get("description")
|
|
55
|
-
|
|
56
|
-
rows.append(
|
|
57
|
-
{
|
|
58
|
-
"ML Model Name": modelName,
|
|
59
|
-
"ML Model Id": model_id,
|
|
60
|
-
"Description": desc,
|
|
61
|
-
}
|
|
62
|
-
)
|
|
63
|
-
|
|
64
|
-
if rows:
|
|
65
|
-
df = pd.DataFrame(rows, columns=list(columns.keys()))
|
|
66
|
-
|
|
67
|
-
return df
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
@log
|
|
71
|
-
def create_ml_model(
|
|
72
|
-
name: str, description: Optional[str] = None, workspace: Optional[str | UUID] = None
|
|
73
|
-
):
|
|
74
|
-
"""
|
|
75
|
-
Creates a Fabric ML model.
|
|
76
|
-
|
|
77
|
-
This is a wrapper function for the following API: `Items - Create ML Model <https://learn.microsoft.com/rest/api/fabric/mlmodel/items/create-ml-model>`_.
|
|
78
|
-
|
|
79
|
-
Parameters
|
|
80
|
-
----------
|
|
81
|
-
name: str
|
|
82
|
-
Name of the ML model.
|
|
83
|
-
description : str, default=None
|
|
84
|
-
A description of the ML model.
|
|
85
|
-
workspace : str | uuid.UUID, default=None
|
|
86
|
-
The Fabric workspace name or ID.
|
|
87
|
-
Defaults to None which resolves to the workspace of the attached lakehouse
|
|
88
|
-
or if no lakehouse attached, resolves to the workspace of the notebook.
|
|
89
|
-
"""
|
|
90
|
-
|
|
91
|
-
create_item(name=name, description=description, type="MLModel", workspace=workspace)
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
@log
|
|
95
|
-
def delete_ml_model(name: str | UUID, workspace: Optional[str | UUID] = None):
|
|
96
|
-
"""
|
|
97
|
-
Deletes a Fabric ML model.
|
|
98
|
-
|
|
99
|
-
This is a wrapper function for the following API: `Items - Delete ML Model <https://learn.microsoft.com/rest/api/fabric/mlmodel/items/delete-ml-model>`_.
|
|
100
|
-
|
|
101
|
-
Parameters
|
|
102
|
-
----------
|
|
103
|
-
name: str | uuid.UUID
|
|
104
|
-
Name or ID of the ML model.
|
|
105
|
-
workspace : str | uuid.UUID, default=None
|
|
106
|
-
The Fabric workspace name or ID.
|
|
107
|
-
Defaults to None which resolves to the workspace of the attached lakehouse
|
|
108
|
-
or if no lakehouse attached, resolves to the workspace of the notebook.
|
|
109
|
-
"""
|
|
110
|
-
|
|
111
|
-
delete_item(item=name, type="MLModel", workspace=workspace)
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
from ._helper_functions import (
|
|
2
|
-
resolve_workspace_id,
|
|
3
|
-
_base_api,
|
|
4
|
-
_create_dataframe,
|
|
5
|
-
_update_dataframe_datatypes,
|
|
6
|
-
delete_item,
|
|
7
|
-
)
|
|
8
|
-
import pandas as pd
|
|
9
|
-
from typing import Optional
|
|
10
|
-
from uuid import UUID
|
|
11
|
-
from sempy._utils._log import log
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
@log
|
|
15
|
-
def list_variable_libraries(workspace: Optional[str | UUID] = None) -> pd.DataFrame:
|
|
16
|
-
"""
|
|
17
|
-
Shows the variable libraries within a workspace.
|
|
18
|
-
|
|
19
|
-
This is a wrapper function for the following API: `Items - List Variable Libraries <https://learn.microsoft.com/rest/api/fabric/variablelibrary/items/list-variable-libraries>`_.
|
|
20
|
-
|
|
21
|
-
Service Principal Authentication is supported (see `here <https://github.com/microsoft/semantic-link-labs/blob/main/notebooks/Service%20Principal.ipynb>`_ for examples).
|
|
22
|
-
|
|
23
|
-
Parameters
|
|
24
|
-
----------
|
|
25
|
-
workspace : str | uuid.UUID, default=None
|
|
26
|
-
The Fabric workspace name or ID.
|
|
27
|
-
Defaults to None which resolves to the workspace of the attached lakehouse
|
|
28
|
-
or if no lakehouse attached, resolves to the workspace of the notebook.
|
|
29
|
-
|
|
30
|
-
Returns
|
|
31
|
-
-------
|
|
32
|
-
pandas.DataFrame
|
|
33
|
-
A pandas dataframe showing the variable libraries within a workspace.
|
|
34
|
-
"""
|
|
35
|
-
|
|
36
|
-
columns = {
|
|
37
|
-
"Variable Library Name": "string",
|
|
38
|
-
"Variable Library Id": "string",
|
|
39
|
-
"Description": "string",
|
|
40
|
-
"Active Value Set Name": "string",
|
|
41
|
-
}
|
|
42
|
-
df = _create_dataframe(columns=columns)
|
|
43
|
-
|
|
44
|
-
workspace_id = resolve_workspace_id(workspace)
|
|
45
|
-
|
|
46
|
-
responses = _base_api(
|
|
47
|
-
request=f"/v1/workspaces/{workspace_id}/VariableLibraries",
|
|
48
|
-
uses_pagination=True,
|
|
49
|
-
client="fabric_sp",
|
|
50
|
-
)
|
|
51
|
-
|
|
52
|
-
rows = []
|
|
53
|
-
for r in responses:
|
|
54
|
-
for v in r.get("value", []):
|
|
55
|
-
prop = v.get("properties", {})
|
|
56
|
-
|
|
57
|
-
rows.append(
|
|
58
|
-
{
|
|
59
|
-
"Variable Library Name": v.get("displayName"),
|
|
60
|
-
"Variable Library Id": v.get("id"),
|
|
61
|
-
"Description": v.get("description"),
|
|
62
|
-
"Active Value Set Name": prop.get("activeValueSetName"),
|
|
63
|
-
}
|
|
64
|
-
)
|
|
65
|
-
|
|
66
|
-
if rows:
|
|
67
|
-
df = pd.DataFrame(rows, columns=list(columns.keys()))
|
|
68
|
-
_update_dataframe_datatypes(dataframe=df, column_map=columns)
|
|
69
|
-
|
|
70
|
-
return df
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
@log
|
|
74
|
-
def delete_variable_library(
|
|
75
|
-
variable_library: str | UUID, workspace: Optional[str | UUID] = None
|
|
76
|
-
):
|
|
77
|
-
"""
|
|
78
|
-
Deletes a variable library.
|
|
79
|
-
|
|
80
|
-
This is a wrapper function for the following API: `Items - Delete Variable Library <https://learn.microsoft.com/rest/api/fabric/warehouse/items/delete-variable-library>`_.
|
|
81
|
-
|
|
82
|
-
Parameters
|
|
83
|
-
----------
|
|
84
|
-
navariable_libraryme: str | uuid.UUID
|
|
85
|
-
Name or ID of the variable library.
|
|
86
|
-
workspace : str | uuid.UUID, default=None
|
|
87
|
-
The Fabric workspace name or ID.
|
|
88
|
-
Defaults to None which resolves to the workspace of the attached lakehouse
|
|
89
|
-
or if no lakehouse attached, resolves to the workspace of the notebook.
|
|
90
|
-
"""
|
|
91
|
-
|
|
92
|
-
delete_item(item=variable_library, type="VariableLibrary", workspace=workspace)
|
|
File without changes
|
{semantic_link_labs-0.11.2.dist-info → semantic_link_labs-0.12.0.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|
|
File without changes
|