semantic-link-labs 0.9.2__py3-none-any.whl → 0.9.4__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.9.2.dist-info → semantic_link_labs-0.9.4.dist-info}/METADATA +10 -6
- {semantic_link_labs-0.9.2.dist-info → semantic_link_labs-0.9.4.dist-info}/RECORD +54 -44
- {semantic_link_labs-0.9.2.dist-info → semantic_link_labs-0.9.4.dist-info}/WHEEL +1 -1
- sempy_labs/__init__.py +27 -1
- sempy_labs/_ai.py +8 -5
- sempy_labs/_capacity_migration.py +3 -2
- sempy_labs/_connections.py +45 -9
- sempy_labs/_dax.py +17 -3
- sempy_labs/_delta_analyzer.py +308 -138
- sempy_labs/_eventhouses.py +70 -1
- sempy_labs/_gateways.py +56 -8
- sempy_labs/_generate_semantic_model.py +30 -9
- sempy_labs/_helper_functions.py +84 -9
- sempy_labs/_job_scheduler.py +226 -2
- sempy_labs/_list_functions.py +42 -19
- sempy_labs/_ml_experiments.py +1 -1
- sempy_labs/_model_bpa.py +17 -2
- sempy_labs/_model_bpa_rules.py +20 -8
- sempy_labs/_semantic_models.py +117 -0
- sempy_labs/_sql.py +73 -6
- sempy_labs/_sqldatabase.py +227 -0
- sempy_labs/_translations.py +2 -2
- sempy_labs/_vertipaq.py +3 -3
- sempy_labs/_warehouses.py +1 -1
- sempy_labs/admin/__init__.py +49 -8
- sempy_labs/admin/_activities.py +166 -0
- sempy_labs/admin/_apps.py +143 -0
- sempy_labs/admin/_basic_functions.py +32 -652
- sempy_labs/admin/_capacities.py +250 -0
- sempy_labs/admin/_datasets.py +184 -0
- sempy_labs/admin/_domains.py +1 -3
- sempy_labs/admin/_items.py +3 -1
- sempy_labs/admin/_reports.py +165 -0
- sempy_labs/admin/_scanner.py +53 -49
- sempy_labs/admin/_shared.py +74 -0
- sempy_labs/admin/_tenant.py +489 -0
- sempy_labs/directlake/_dl_helper.py +0 -1
- sempy_labs/directlake/_update_directlake_partition_entity.py +6 -0
- sempy_labs/graph/_teams.py +1 -1
- sempy_labs/graph/_users.py +9 -1
- sempy_labs/lakehouse/_get_lakehouse_columns.py +2 -2
- sempy_labs/lakehouse/_get_lakehouse_tables.py +2 -2
- sempy_labs/lakehouse/_lakehouse.py +3 -3
- sempy_labs/lakehouse/_shortcuts.py +29 -16
- sempy_labs/migration/_migrate_calctables_to_lakehouse.py +2 -2
- sempy_labs/migration/_refresh_calc_tables.py +2 -2
- sempy_labs/report/__init__.py +3 -1
- sempy_labs/report/_download_report.py +4 -1
- sempy_labs/report/_export_report.py +272 -0
- sempy_labs/report/_report_functions.py +11 -263
- sempy_labs/report/_report_rebind.py +1 -1
- sempy_labs/tom/_model.py +281 -29
- {semantic_link_labs-0.9.2.dist-info → semantic_link_labs-0.9.4.dist-info}/LICENSE +0 -0
- {semantic_link_labs-0.9.2.dist-info → semantic_link_labs-0.9.4.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import pandas as pd
|
|
2
|
+
from typing import Optional
|
|
3
|
+
from sempy_labs._helper_functions import (
|
|
4
|
+
_build_url,
|
|
5
|
+
_base_api,
|
|
6
|
+
_create_dataframe,
|
|
7
|
+
_update_dataframe_datatypes,
|
|
8
|
+
_is_valid_uuid,
|
|
9
|
+
)
|
|
10
|
+
from uuid import UUID
|
|
11
|
+
import sempy_labs._icons as icons
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def list_apps(
|
|
15
|
+
top: Optional[int] = 1000,
|
|
16
|
+
skip: Optional[int] = None,
|
|
17
|
+
) -> pd.DataFrame:
|
|
18
|
+
"""
|
|
19
|
+
Shows a list of apps in the organization.
|
|
20
|
+
|
|
21
|
+
This is a wrapper function for the following API: `Admin - Apps GetAppsAsAdmin <https://learn.microsoft.com/rest/api/power-bi/admin/apps-get-apps-as-admin>`_.
|
|
22
|
+
|
|
23
|
+
Service Principal Authentication is supported (see `here <https://github.com/microsoft/semantic-link-labs/blob/main/notebooks/Service%20Principal.ipynb>`_ for examples).
|
|
24
|
+
|
|
25
|
+
Parameters
|
|
26
|
+
----------
|
|
27
|
+
top : int, default=1000
|
|
28
|
+
Returns only the first n results.
|
|
29
|
+
skip : int, default=None
|
|
30
|
+
Skips the first n results.
|
|
31
|
+
|
|
32
|
+
Returns
|
|
33
|
+
-------
|
|
34
|
+
pandas.DataFrame
|
|
35
|
+
A pandas dataframe showing a list of apps in the organization.
|
|
36
|
+
"""
|
|
37
|
+
|
|
38
|
+
columns = {
|
|
39
|
+
"App Name": "string",
|
|
40
|
+
"App Id": "string",
|
|
41
|
+
"Description": "string",
|
|
42
|
+
"Published By": "string",
|
|
43
|
+
"Last Update": "datetime",
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
df = _create_dataframe(columns=columns)
|
|
47
|
+
|
|
48
|
+
params = {}
|
|
49
|
+
url = "/v1.0/myorg/admin/apps"
|
|
50
|
+
|
|
51
|
+
params["$top"] = top
|
|
52
|
+
|
|
53
|
+
if skip is not None:
|
|
54
|
+
params["$skip"] = skip
|
|
55
|
+
|
|
56
|
+
url = _build_url(url, params)
|
|
57
|
+
response = _base_api(request=url, client="fabric_sp")
|
|
58
|
+
|
|
59
|
+
rows = []
|
|
60
|
+
for v in response.json().get("value", []):
|
|
61
|
+
rows.append(
|
|
62
|
+
{
|
|
63
|
+
"App Name": v.get("name"),
|
|
64
|
+
"App Id": v.get("id"),
|
|
65
|
+
"Description": v.get("description"),
|
|
66
|
+
"Published By": v.get("publishedBy"),
|
|
67
|
+
"Last Update": v.get("lastUpdate"),
|
|
68
|
+
}
|
|
69
|
+
)
|
|
70
|
+
|
|
71
|
+
if rows:
|
|
72
|
+
df = pd.DataFrame(rows, columns=list(columns.keys()))
|
|
73
|
+
|
|
74
|
+
_update_dataframe_datatypes(dataframe=df, column_map=columns)
|
|
75
|
+
|
|
76
|
+
return df
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
def _resolve_app_id(app: str | UUID) -> str:
|
|
80
|
+
if _is_valid_uuid(app):
|
|
81
|
+
return app
|
|
82
|
+
else:
|
|
83
|
+
df = list_apps()
|
|
84
|
+
df_filt = df[df["App Name"] == app]
|
|
85
|
+
if df_filt.empty:
|
|
86
|
+
raise ValueError(f"{icons.red_dot} The '{app}' app does not exist.")
|
|
87
|
+
return df_filt["App Id"].iloc[0]
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
def list_app_users(app: str | UUID) -> pd.DataFrame:
|
|
91
|
+
"""
|
|
92
|
+
Shows a list of users that have access to the specified app.
|
|
93
|
+
|
|
94
|
+
This is a wrapper function for the following API: `Admin - Apps GetAppUsersAsAdmin <https://learn.microsoft.com/rest/api/power-bi/admin/apps-get-app-users-as-admin>`_.
|
|
95
|
+
|
|
96
|
+
Service Principal Authentication is supported (see `here <https://github.com/microsoft/semantic-link-labs/blob/main/notebooks/Service%20Principal.ipynb>`_ for examples).
|
|
97
|
+
|
|
98
|
+
Parameters
|
|
99
|
+
----------
|
|
100
|
+
app : str | uuid.UUID
|
|
101
|
+
The name or ID of the app.
|
|
102
|
+
|
|
103
|
+
Returns
|
|
104
|
+
-------
|
|
105
|
+
pandas.DataFrame
|
|
106
|
+
A pandas dataframe showing a list of users that have access to the specified app.
|
|
107
|
+
"""
|
|
108
|
+
|
|
109
|
+
app_id = _resolve_app_id(app)
|
|
110
|
+
|
|
111
|
+
columns = {
|
|
112
|
+
"User Name": "string",
|
|
113
|
+
"Email Address": "string",
|
|
114
|
+
"App User Access Right": "string",
|
|
115
|
+
"Identifier": "string",
|
|
116
|
+
"Graph Id": "string",
|
|
117
|
+
"Principal Type": "string",
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
df = _create_dataframe(columns=columns)
|
|
121
|
+
|
|
122
|
+
url = f"/v1.0/myorg/admin/apps/{app_id}/users"
|
|
123
|
+
response = _base_api(request=url, client="fabric_sp")
|
|
124
|
+
|
|
125
|
+
rows = []
|
|
126
|
+
for v in response.json().get("value", []):
|
|
127
|
+
rows.append(
|
|
128
|
+
{
|
|
129
|
+
"User Name": v.get("displayName"),
|
|
130
|
+
"Email Address": v.get("emailAddress"),
|
|
131
|
+
"App User Access Right": v.get("appUserAccessRight"),
|
|
132
|
+
"Identifier": v.get("identifier"),
|
|
133
|
+
"Graph Id": v.get("graphId"),
|
|
134
|
+
"Principal Type": v.get("principalType"),
|
|
135
|
+
}
|
|
136
|
+
)
|
|
137
|
+
|
|
138
|
+
if rows:
|
|
139
|
+
df = pd.DataFrame(rows, columns=list(columns.keys()))
|
|
140
|
+
|
|
141
|
+
_update_dataframe_datatypes(dataframe=df, column_map=columns)
|
|
142
|
+
|
|
143
|
+
return df
|