msfabricpysdkcore 0.0.13__py3-none-any.whl → 0.1.2__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.
- msfabricpysdkcore/__init__.py +2 -1
- msfabricpysdkcore/admin_item.py +19 -45
- msfabricpysdkcore/admin_workspace.py +13 -60
- msfabricpysdkcore/adminapi.py +401 -476
- msfabricpysdkcore/auth.py +10 -6
- msfabricpysdkcore/client.py +124 -7
- msfabricpysdkcore/coreapi.py +2570 -822
- msfabricpysdkcore/deployment_pipeline.py +34 -146
- msfabricpysdkcore/domain.py +20 -219
- msfabricpysdkcore/environment.py +13 -172
- msfabricpysdkcore/fabric_azure_capacity.py +77 -0
- msfabricpysdkcore/fabric_azure_client.py +228 -0
- msfabricpysdkcore/item.py +55 -331
- msfabricpysdkcore/job_instance.py +8 -22
- msfabricpysdkcore/lakehouse.py +9 -118
- msfabricpysdkcore/long_running_operation.py +7 -37
- msfabricpysdkcore/onelakeshortcut.py +7 -21
- msfabricpysdkcore/otheritems.py +66 -91
- msfabricpysdkcore/spark_custom_pool.py +7 -47
- msfabricpysdkcore/tests/test_admin_apis.py +9 -10
- msfabricpysdkcore/tests/test_datapipelines.py +15 -18
- msfabricpysdkcore/tests/test_deployment_pipeline.py +3 -3
- msfabricpysdkcore/tests/test_domains.py +6 -5
- msfabricpysdkcore/tests/test_environments.py +54 -5
- msfabricpysdkcore/tests/test_evenhouses.py +47 -0
- msfabricpysdkcore/tests/test_evenstreams.py +20 -20
- msfabricpysdkcore/tests/test_external_data_shares.py +3 -3
- msfabricpysdkcore/tests/test_fabric_azure_client.py +78 -0
- msfabricpysdkcore/tests/test_git.py +8 -9
- msfabricpysdkcore/tests/test_items.py +81 -0
- msfabricpysdkcore/tests/test_jobs.py +2 -2
- msfabricpysdkcore/tests/test_kql_queryset.py +49 -0
- msfabricpysdkcore/tests/test_kqldatabases.py +3 -3
- msfabricpysdkcore/tests/test_lakehouse.py +84 -0
- msfabricpysdkcore/tests/test_ml_experiments.py +47 -0
- msfabricpysdkcore/tests/test_ml_models.py +47 -0
- msfabricpysdkcore/tests/test_notebooks.py +57 -0
- msfabricpysdkcore/tests/test_one_lake_data_access_security.py +2 -4
- msfabricpysdkcore/tests/test_other_items.py +45 -0
- msfabricpysdkcore/tests/test_reports.py +52 -0
- msfabricpysdkcore/tests/test_semantic_model.py +50 -0
- msfabricpysdkcore/tests/test_shortcuts.py +4 -4
- msfabricpysdkcore/tests/test_spark.py +9 -9
- msfabricpysdkcore/tests/test_sparkjobdefinition.py +2 -2
- msfabricpysdkcore/tests/test_warehouses.py +50 -0
- msfabricpysdkcore/tests/test_workspaces_capacities.py +16 -13
- msfabricpysdkcore/workspace.py +397 -1163
- {msfabricpysdkcore-0.0.13.dist-info → msfabricpysdkcore-0.1.2.dist-info}/METADATA +72 -10
- msfabricpysdkcore-0.1.2.dist-info/RECORD +55 -0
- {msfabricpysdkcore-0.0.13.dist-info → msfabricpysdkcore-0.1.2.dist-info}/WHEEL +1 -1
- msfabricpysdkcore-0.0.13.dist-info/RECORD +0 -41
- {msfabricpysdkcore-0.0.13.dist-info → msfabricpysdkcore-0.1.2.dist-info}/LICENSE +0 -0
- {msfabricpysdkcore-0.0.13.dist-info → msfabricpysdkcore-0.1.2.dist-info}/top_level.txt +0 -0
msfabricpysdkcore/__init__.py
CHANGED
msfabricpysdkcore/admin_item.py
CHANGED
@@ -1,29 +1,26 @@
|
|
1
1
|
import json
|
2
|
-
from
|
3
|
-
|
4
|
-
import requests
|
2
|
+
from msfabricpysdkcore.adminapi import FabricClientAdmin
|
5
3
|
|
6
4
|
|
7
5
|
class AdminItem:
|
8
6
|
"""Class to represent a item in Microsoft Fabric"""
|
9
7
|
|
10
|
-
def __init__(self, id, type, name, workspace_id, state, description, last_updated_date, capacity_id, creator_principal,
|
8
|
+
def __init__(self, id, type, name, workspace_id, state, description, last_updated_date, capacity_id, creator_principal, admin_client: FabricClientAdmin) -> None:
|
11
9
|
"""Constructor for the Item class
|
12
10
|
|
13
11
|
Args:
|
14
12
|
id (str): The ID of the item
|
15
13
|
type (str): The type of the item
|
16
14
|
name (str): The name of the item
|
17
|
-
workspace_id (str): The ID of the workspace
|
15
|
+
workspace_id (str): The ID of the workspace to which the item belongs
|
18
16
|
state (str): The state of the item
|
19
17
|
description (str): The description of the item
|
20
|
-
last_updated_date (str): The
|
21
|
-
capacity_id (str): The
|
22
|
-
creator_principal (
|
23
|
-
|
24
|
-
Returns:
|
25
|
-
Item: The Item object
|
18
|
+
last_updated_date (str): The date when the item was last updated
|
19
|
+
capacity_id (str): The
|
20
|
+
creator_principal (str): The principal who created the item
|
21
|
+
admin_client (FabricClientAdmin): The FabricClientAdmin object
|
26
22
|
"""
|
23
|
+
|
27
24
|
self.id = id
|
28
25
|
self.type = type
|
29
26
|
self.name = name
|
@@ -33,7 +30,7 @@ class AdminItem:
|
|
33
30
|
self.last_updated_date = last_updated_date
|
34
31
|
self.capacity_id = capacity_id
|
35
32
|
self.creator_principal = creator_principal
|
36
|
-
self.
|
33
|
+
self.admin_client = admin_client
|
37
34
|
|
38
35
|
|
39
36
|
def __str__(self) -> str:
|
@@ -59,55 +56,32 @@ class AdminItem:
|
|
59
56
|
def __repr__(self) -> str:
|
60
57
|
return self.__str__()
|
61
58
|
|
62
|
-
def from_dict(item_dict,
|
59
|
+
def from_dict(item_dict, admin_client):
|
63
60
|
"""Create Item object from dictionary
|
64
61
|
|
65
62
|
Args:
|
66
|
-
item_dict (dict): The dictionary containing the item
|
67
|
-
|
63
|
+
item_dict (dict): The dictionary containing the item details
|
64
|
+
admin_client (FabricClientAdmin): The FabricClientAdmin object
|
68
65
|
Returns:
|
69
|
-
|
66
|
+
AdminItem: The AdminItem object
|
67
|
+
"""
|
70
68
|
return AdminItem(
|
71
69
|
id = item_dict['id'],
|
72
70
|
type = item_dict['type'],
|
73
|
-
name = item_dict
|
71
|
+
name = item_dict.get('name', None),
|
74
72
|
workspace_id = item_dict['workspaceId'],
|
75
73
|
state = item_dict['state'],
|
76
74
|
description = item_dict.get('description', None),
|
77
75
|
last_updated_date = item_dict['lastUpdatedDate'],
|
78
76
|
capacity_id = item_dict['capacityId'],
|
79
|
-
creator_principal = item_dict
|
80
|
-
|
77
|
+
creator_principal = item_dict.get('creatorPrincipal', None),
|
78
|
+
admin_client = admin_client
|
81
79
|
)
|
82
|
-
|
83
|
-
def get_item_access_details(self, type=None):
|
84
|
-
"""Get the access details of the item
|
85
|
-
|
86
|
-
Returns:
|
87
|
-
dict: The access details of the item"""
|
88
|
-
return self.list_item_access_details(type)
|
89
|
-
|
80
|
+
|
90
81
|
def list_item_access_details(self, type=None):
|
91
82
|
"""Get the access details of the item
|
92
83
|
|
93
84
|
Returns:
|
94
85
|
dict: The access details of the item"""
|
95
86
|
|
96
|
-
|
97
|
-
|
98
|
-
if type:
|
99
|
-
url += f"?type={self.type}"
|
100
|
-
|
101
|
-
for _ in range(10):
|
102
|
-
response = requests.get(url=url, headers=self.auth.get_headers())
|
103
|
-
if response.status_code == 429:
|
104
|
-
print("Too many requests, waiting 10 seconds")
|
105
|
-
sleep(10)
|
106
|
-
continue
|
107
|
-
if response.status_code not in (200, 429):
|
108
|
-
print(response.status_code)
|
109
|
-
print(response.text)
|
110
|
-
raise Exception(f"Error getting item: {response.text}")
|
111
|
-
break
|
112
|
-
|
113
|
-
return json.loads(response.text)
|
87
|
+
return self.admin_client.list_item_access_details(self.workspace_id, self.id, type)
|
@@ -1,15 +1,14 @@
|
|
1
1
|
import json
|
2
2
|
from time import sleep
|
3
3
|
|
4
|
-
import requests
|
5
|
-
|
6
4
|
from msfabricpysdkcore.admin_item import AdminItem
|
5
|
+
from msfabricpysdkcore.adminapi import FabricClientAdmin
|
7
6
|
|
8
7
|
|
9
8
|
class AdminWorkspace:
|
10
9
|
"""Class to represent a workspace in Microsoft Fabric"""
|
11
10
|
|
12
|
-
def __init__(self, id, type, name, state, capacity_id,
|
11
|
+
def __init__(self, id, type, name, state, capacity_id, admin_client:FabricClientAdmin) -> None:
|
13
12
|
"""Constructor for the Workspace class
|
14
13
|
|
15
14
|
Args:
|
@@ -18,7 +17,7 @@ class AdminWorkspace:
|
|
18
17
|
name (str): The name of the workspace
|
19
18
|
state (str): The state of the workspace
|
20
19
|
capacity_id (str): The ID of the capacity
|
21
|
-
|
20
|
+
admin_client (FabricClientAdmin): The FabricClientAdmin object
|
22
21
|
Returns:
|
23
22
|
Workspace: The Workspace object
|
24
23
|
"""
|
@@ -27,7 +26,7 @@ class AdminWorkspace:
|
|
27
26
|
self.name = name
|
28
27
|
self.state = state
|
29
28
|
self.capacity_id = capacity_id
|
30
|
-
self.
|
29
|
+
self.admin_client = admin_client
|
31
30
|
|
32
31
|
|
33
32
|
def __str__(self) -> str:
|
@@ -49,12 +48,12 @@ class AdminWorkspace:
|
|
49
48
|
def __repr__(self) -> str:
|
50
49
|
return self.__str__()
|
51
50
|
|
52
|
-
def from_dict(item_dict,
|
51
|
+
def from_dict(item_dict, admin_client):
|
53
52
|
"""Create Workspace object from dictionary
|
54
53
|
|
55
54
|
Args:
|
56
55
|
item_dict (dict): The dictionary representing the workspace
|
57
|
-
|
56
|
+
admin_client (FabricClientAdmin): The FabricClientAdmin object
|
58
57
|
Returns:
|
59
58
|
Workspace: The Workspace object
|
60
59
|
"""
|
@@ -64,39 +63,19 @@ class AdminWorkspace:
|
|
64
63
|
name=item_dict['name'],
|
65
64
|
state=item_dict['state'],
|
66
65
|
capacity_id=item_dict['capacityId'],
|
67
|
-
|
66
|
+
admin_client=admin_client
|
68
67
|
)
|
69
|
-
|
70
|
-
def get_workspace_access_details(self):
|
71
|
-
"""Get the access details of the workspace
|
72
|
-
|
73
|
-
Returns:
|
74
|
-
dict: The access details of the workspace
|
75
|
-
"""
|
76
|
-
return self.list_workspace_access_details()
|
77
|
-
|
68
|
+
|
78
69
|
def list_workspace_access_details(self):
|
79
70
|
"""Get the access details of the workspace
|
80
71
|
|
81
72
|
Returns:
|
82
73
|
dict: The access details of the workspace
|
83
74
|
"""
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
response = requests.get(url=url, headers=self.auth.get_headers())
|
88
|
-
if response.status_code == 429:
|
89
|
-
print("Too many requests, waiting 10 seconds")
|
90
|
-
sleep(10)
|
91
|
-
continue
|
92
|
-
if response.status_code not in (200, 429):
|
93
|
-
print(response.status_code)
|
94
|
-
print(response.text)
|
95
|
-
raise Exception(f"Error getting workspace: {response.text}")
|
96
|
-
break
|
75
|
+
return self.admin_client.list_workspace_access_details(self.id)
|
76
|
+
|
77
|
+
# Items
|
97
78
|
|
98
|
-
return json.loads(response.text)
|
99
|
-
|
100
79
|
def get_item(self, item_id, type = None):
|
101
80
|
"""Get an item from the workspace
|
102
81
|
|
@@ -106,22 +85,7 @@ class AdminWorkspace:
|
|
106
85
|
Returns:
|
107
86
|
AdminItem: The item object
|
108
87
|
"""
|
109
|
-
|
110
|
-
if type:
|
111
|
-
url += f"?type={type}"
|
112
|
-
for _ in range(10):
|
113
|
-
response = requests.get(url=url, headers=self.auth.get_headers())
|
114
|
-
if response.status_code == 429:
|
115
|
-
print("Too many requests, waiting 10 seconds")
|
116
|
-
sleep(10)
|
117
|
-
continue
|
118
|
-
if response.status_code not in (200, 429):
|
119
|
-
print(response.status_code)
|
120
|
-
print(response.text)
|
121
|
-
raise Exception(f"Error getting item: {response.text}")
|
122
|
-
break
|
123
|
-
item_dict = json.loads(response.text)
|
124
|
-
return AdminItem.from_dict(item_dict, self.auth)
|
88
|
+
return self.admin_client.get_item(self.id, item_id, type)
|
125
89
|
|
126
90
|
def list_item_access_details(self, item_id, type=None):
|
127
91
|
"""Get the access details of the item
|
@@ -132,15 +96,4 @@ class AdminWorkspace:
|
|
132
96
|
Returns:
|
133
97
|
dict: The access details of the item
|
134
98
|
"""
|
135
|
-
return self.
|
136
|
-
|
137
|
-
def get_item_access_details(self, item_id, type=None):
|
138
|
-
"""Get the access details of the item
|
139
|
-
|
140
|
-
Args:
|
141
|
-
item_id (str): The ID of the item
|
142
|
-
type (str): The type of the item
|
143
|
-
Returns:
|
144
|
-
dict: The access details of the item
|
145
|
-
"""
|
146
|
-
return self.list_item_access_details(item_id, type)
|
99
|
+
return self.admin_client.list_item_access_details(self.id, item_id, type)
|