msfabricpysdkcore 0.1.2__py3-none-any.whl → 0.1.3__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 +3 -1
- msfabricpysdkcore/adminapi.py +10 -5
- msfabricpysdkcore/auth.py +25 -9
- msfabricpysdkcore/client.py +17 -6
- msfabricpysdkcore/coreapi.py +34 -19
- msfabricpysdkcore/deployment_pipeline.py +5 -3
- msfabricpysdkcore/fabric_azure_client.py +7 -3
- msfabricpysdkcore/long_running_operation.py +14 -5
- msfabricpysdkcore/util/__init__.py +3 -0
- msfabricpysdkcore/util/logger.py +32 -0
- {msfabricpysdkcore-0.1.2.dist-info → msfabricpysdkcore-0.1.3.dist-info}/METADATA +18 -2
- {msfabricpysdkcore-0.1.2.dist-info → msfabricpysdkcore-0.1.3.dist-info}/RECORD +15 -13
- {msfabricpysdkcore-0.1.2.dist-info → msfabricpysdkcore-0.1.3.dist-info}/LICENSE +0 -0
- {msfabricpysdkcore-0.1.2.dist-info → msfabricpysdkcore-0.1.3.dist-info}/WHEEL +0 -0
- {msfabricpysdkcore-0.1.2.dist-info → msfabricpysdkcore-0.1.3.dist-info}/top_level.txt +0 -0
msfabricpysdkcore/__init__.py
CHANGED
msfabricpysdkcore/adminapi.py
CHANGED
@@ -2,6 +2,7 @@ import requests
|
|
2
2
|
import json
|
3
3
|
import os
|
4
4
|
from time import sleep
|
5
|
+
from warnings import warn
|
5
6
|
|
6
7
|
from msfabricpysdkcore.client import FabricClient
|
7
8
|
|
@@ -17,7 +18,7 @@ class FabricClientAdmin(FabricClient):
|
|
17
18
|
def long_running_operation(self, response_headers):
|
18
19
|
"""Check the status of a long running operation"""
|
19
20
|
from msfabricpysdkcore.coreapi import FabricClientCore
|
20
|
-
fc = FabricClientCore(tenant_id=self.tenant_id, client_id=self.client_id, client_secret=self.client_secret
|
21
|
+
fc = FabricClientCore(tenant_id=self.tenant_id, client_id=self.client_id, client_secret=self.client_secret)
|
21
22
|
|
22
23
|
return fc.long_running_operation(response_headers)
|
23
24
|
|
@@ -171,7 +172,7 @@ class FabricClientAdmin(FabricClient):
|
|
171
172
|
|
172
173
|
if workspace_objects:
|
173
174
|
from msfabricpysdkcore import FabricClientCore
|
174
|
-
fc = FabricClientCore(tenant_id=self.tenant_id, client_id=self.client_id, client_secret=self.client_secret
|
175
|
+
fc = FabricClientCore(tenant_id=self.tenant_id, client_id=self.client_id, client_secret=self.client_secret)
|
175
176
|
workspaces = [fc.get_workspace_by_id(workspace["id"]) for workspace in workspaces]
|
176
177
|
|
177
178
|
return workspaces
|
@@ -300,9 +301,13 @@ class FabricClientAdmin(FabricClient):
|
|
300
301
|
return_format="json")
|
301
302
|
|
302
303
|
if return_item == "Default":
|
303
|
-
|
304
|
-
|
305
|
-
|
304
|
+
warn(
|
305
|
+
message="Updating a domain currently will make invoke an additional API call to get the domain "
|
306
|
+
"object. This default behaviour will change in newer versions of the SDK. To keep this "
|
307
|
+
"behaviour, set return_item=True in the function call.",
|
308
|
+
category=FutureWarning,
|
309
|
+
stacklevel=2
|
310
|
+
)
|
306
311
|
if return_item:
|
307
312
|
return self.get_domain_by_id(domain_id)
|
308
313
|
return response_json
|
msfabricpysdkcore/auth.py
CHANGED
@@ -1,6 +1,10 @@
|
|
1
|
+
from warnings import warn
|
2
|
+
|
1
3
|
import requests
|
2
4
|
from abc import abstractmethod
|
3
5
|
from azure.identity import AzureCliCredential
|
6
|
+
from msfabricpysdkcore.util import logger
|
7
|
+
import logging
|
4
8
|
try:
|
5
9
|
from notebookutils import mssparkutils
|
6
10
|
except ImportError:
|
@@ -8,7 +12,11 @@ except ImportError:
|
|
8
12
|
class FabricAuth():
|
9
13
|
"""FabricAuth class to interact with Entra ID"""
|
10
14
|
|
15
|
+
_logger: logging.Logger
|
16
|
+
|
11
17
|
def __init__(self, scope):
|
18
|
+
"""Initialize FabricAuth object"""
|
19
|
+
self._logger = logger.getChild(__name__)
|
12
20
|
self.scope = scope
|
13
21
|
|
14
22
|
@abstractmethod
|
@@ -29,12 +37,14 @@ class FabricAuth():
|
|
29
37
|
class FabricAuthClient(FabricAuth):
|
30
38
|
"""FabricAuthClient class to interact with Entra ID"""
|
31
39
|
|
32
|
-
def __init__(self, scope, silent =
|
40
|
+
def __init__(self, scope, silent = None):
|
33
41
|
super().__init__(scope)
|
34
|
-
|
35
|
-
print("Using Azure CLI for authentication")
|
42
|
+
self._logger.info("Using Azure CLI for authentication")
|
36
43
|
self.auth = AzureCliCredential()
|
37
44
|
|
45
|
+
if silent is not None:
|
46
|
+
warn("The 'silent' parameter is deprecated and will be removed in a future version.", DeprecationWarning, stacklevel=2)
|
47
|
+
|
38
48
|
def get_token(self):
|
39
49
|
"""Get token from Azure AD"""
|
40
50
|
token = self.auth.get_token(self.scope)
|
@@ -43,16 +53,18 @@ class FabricAuthClient(FabricAuth):
|
|
43
53
|
class FabricServicePrincipal(FabricAuth):
|
44
54
|
"""FabricServicePrincipal class to interact with Entra ID"""
|
45
55
|
|
46
|
-
def __init__(self, tenant_id, client_id, client_secret, scope, silent =
|
56
|
+
def __init__(self, tenant_id, client_id, client_secret, scope, silent = None):
|
47
57
|
super().__init__(scope)
|
48
58
|
|
49
|
-
|
50
|
-
print("Using Service Principal for authentication")
|
59
|
+
self._logger.info("Using Service Principal for authentication")
|
51
60
|
|
52
61
|
self.tenant_id = tenant_id
|
53
62
|
self.client_id = client_id
|
54
63
|
self.client_secret = client_secret
|
55
64
|
|
65
|
+
if silent is not None:
|
66
|
+
warn("The 'silent' parameter is deprecated and will be removed in a future version.", DeprecationWarning, stacklevel=2)
|
67
|
+
|
56
68
|
|
57
69
|
def get_token(self):
|
58
70
|
"""Get token from Azure AD"""
|
@@ -71,10 +83,14 @@ class FabricServicePrincipal(FabricAuth):
|
|
71
83
|
class FabricSparkUtilsAuthentication(FabricAuth):
|
72
84
|
"""FabricSparkUtilsAuthentication class to interact with Entra ID"""
|
73
85
|
|
74
|
-
def __init__(self, scope, silent
|
86
|
+
def __init__(self, scope, silent=None):
|
87
|
+
# super().__init__(scope)
|
88
|
+
|
75
89
|
mssparkutils.credentials.getToken("pbi")
|
76
|
-
|
77
|
-
|
90
|
+
self._logger.info("Using Synapse Spark Utils for authentication")
|
91
|
+
|
92
|
+
if silent is not None:
|
93
|
+
warn("The 'silent' parameter is deprecated and will be removed in a future version.", DeprecationWarning, stacklevel=2)
|
78
94
|
|
79
95
|
def get_token(self):
|
80
96
|
"""Get token from Azure AD"""
|
msfabricpysdkcore/client.py
CHANGED
@@ -1,16 +1,24 @@
|
|
1
|
+
import logging
|
1
2
|
from abc import abstractmethod
|
2
3
|
import os
|
4
|
+
from warnings import warn
|
3
5
|
from time import sleep
|
4
6
|
import requests
|
5
7
|
import json
|
6
8
|
|
7
9
|
from msfabricpysdkcore.auth import FabricAuthClient, FabricServicePrincipal, FabricSparkUtilsAuthentication
|
10
|
+
from msfabricpysdkcore.util import logger
|
8
11
|
|
9
12
|
class FabricClient():
|
10
13
|
"""FabricClient class to interact with Fabric API"""
|
11
14
|
|
12
|
-
|
15
|
+
_logger: logging.Logger
|
16
|
+
|
17
|
+
def __init__(self, scope, tenant_id = None, client_id = None, client_secret = None, silent=None) -> None:
|
13
18
|
"""Initialize FabricClient object"""
|
19
|
+
|
20
|
+
self._logger = logger.getChild(__name__)
|
21
|
+
|
14
22
|
self.tenant_id = tenant_id if tenant_id else os.getenv("FABRIC_TENANT_ID")
|
15
23
|
self.client_id = client_id if client_id else os.getenv("FABRIC_CLIENT_ID")
|
16
24
|
self.client_secret = client_secret if client_secret else os.getenv("FABRIC_CLIENT_SECRET")
|
@@ -19,15 +27,18 @@ class FabricClient():
|
|
19
27
|
|
20
28
|
if self.client_id is None or self.client_secret is None or self.tenant_id is None:
|
21
29
|
try:
|
22
|
-
self.auth = FabricSparkUtilsAuthentication(self.scope
|
30
|
+
self.auth = FabricSparkUtilsAuthentication(self.scope)
|
23
31
|
except:
|
24
|
-
self.auth = FabricAuthClient(self.scope
|
32
|
+
self.auth = FabricAuthClient(self.scope)
|
25
33
|
else:
|
26
34
|
self.auth = FabricServicePrincipal(scope= self.scope,
|
27
35
|
tenant_id = self.tenant_id,
|
28
36
|
client_id = self.client_id,
|
29
|
-
client_secret = self.client_secret
|
30
|
-
|
37
|
+
client_secret = self.client_secret)
|
38
|
+
|
39
|
+
if silent is not None:
|
40
|
+
warn("The 'silent' parameter is deprecated and will be removed in a future version.", DeprecationWarning, stacklevel=2)
|
41
|
+
|
31
42
|
|
32
43
|
def get_token(self):
|
33
44
|
"""Get token from Entra"""
|
@@ -91,7 +102,7 @@ class FabricClient():
|
|
91
102
|
else:
|
92
103
|
raise ValueError("Invalid operation")
|
93
104
|
if response.status_code == 429:
|
94
|
-
|
105
|
+
self._logger.info("Too many requests, waiting 10 seconds")
|
95
106
|
sleep(10)
|
96
107
|
continue
|
97
108
|
elif response.status_code == 202:
|
msfabricpysdkcore/coreapi.py
CHANGED
@@ -1,17 +1,22 @@
|
|
1
1
|
import json
|
2
2
|
from time import sleep
|
3
|
+
from warnings import warn
|
3
4
|
|
4
5
|
from msfabricpysdkcore.client import FabricClient
|
6
|
+
from msfabricpysdkcore.util import logger
|
7
|
+
|
5
8
|
|
6
9
|
class FabricClientCore(FabricClient):
|
7
10
|
"""FabricClientCore class to interact with Fabric Core APIs"""
|
8
11
|
|
9
|
-
def __init__(self, tenant_id = None, client_id = None, client_secret = None, silent=
|
12
|
+
def __init__(self, tenant_id = None, client_id = None, client_secret = None, silent=None) -> None:
|
10
13
|
"""Initialize FabricClientCore object"""
|
11
14
|
super().__init__(scope="https://api.fabric.microsoft.com/.default",
|
12
15
|
tenant_id=tenant_id,
|
13
16
|
client_id=client_id,
|
14
|
-
client_secret=client_secret
|
17
|
+
client_secret=client_secret)
|
18
|
+
if silent is not None:
|
19
|
+
warn("The 'silent' parameter is deprecated and will be removed in a future version.", DeprecationWarning, stacklevel=2)
|
15
20
|
|
16
21
|
def long_running_operation(self, response_headers):
|
17
22
|
"""Check the status of a long running operation"""
|
@@ -110,7 +115,7 @@ class FabricClientCore(FabricClient):
|
|
110
115
|
return DeploymentPipeline.from_dict(result_json, self)
|
111
116
|
|
112
117
|
def get_deployment_pipeline_stages_items(self, pipeline_id, stage_id = None, stage_name = None):
|
113
|
-
|
118
|
+
warn("DEPRECATED: get_deployment_pipeline_stages_items. get_deployment_pipeline_stages_items. Use list_deployment_pipeline_stages_items instead", DeprecationWarning, stacklevel=2)
|
114
119
|
return self.list_deployment_pipeline_stages_items(pipeline_id, stage_id, stage_name)
|
115
120
|
|
116
121
|
def list_deployment_pipeline_stages_items(self, deployment_pipeline_id, stage_id = None, stage_name = None):
|
@@ -139,7 +144,7 @@ class FabricClientCore(FabricClient):
|
|
139
144
|
error_message="Error getting deployment pipeline stage items", return_format="value_json", paging=True)
|
140
145
|
|
141
146
|
return items
|
142
|
-
|
147
|
+
|
143
148
|
def get_deployment_pipeline_stages(self, pipeline_id):
|
144
149
|
"""Get the stages of a deployment pipeline
|
145
150
|
Args:
|
@@ -147,9 +152,9 @@ class FabricClientCore(FabricClient):
|
|
147
152
|
Returns:
|
148
153
|
list: List of DeploymentPipelineStage objects
|
149
154
|
"""
|
150
|
-
|
155
|
+
warn("DEPRECATED: get_deployment_pipeline_stages. Use list_deployment_pipeline_stages instead", DeprecationWarning, stacklevel=2)
|
151
156
|
return self.list_deployment_pipeline_stages(pipeline_id)
|
152
|
-
|
157
|
+
|
153
158
|
def list_deployment_pipeline_stages(self, deployment_pipeline_id):
|
154
159
|
"""Get the stages of a deployment pipeline
|
155
160
|
Args:
|
@@ -528,7 +533,7 @@ class FabricClientCore(FabricClient):
|
|
528
533
|
|
529
534
|
|
530
535
|
if item_dict is None or "no_operation_result" in item_dict:
|
531
|
-
|
536
|
+
self._logger.debug("Item not returned by API, trying to get it by name")
|
532
537
|
item = None
|
533
538
|
i = 0
|
534
539
|
|
@@ -553,11 +558,11 @@ class FabricClientCore(FabricClient):
|
|
553
558
|
item = self.get_item_by_name(workspace_id, display_name, type)
|
554
559
|
if item is not None:
|
555
560
|
return item
|
556
|
-
|
561
|
+
self._logger.debug("Item not found, waiting 5 seconds")
|
557
562
|
sleep(5)
|
558
563
|
i += 1
|
559
564
|
|
560
|
-
|
565
|
+
self._logger.info("Item not found after 1 minute, returning None")
|
561
566
|
return None
|
562
567
|
|
563
568
|
return self.get_item_specific(workspace_id, item_dict)
|
@@ -709,9 +714,13 @@ class FabricClientCore(FabricClient):
|
|
709
714
|
response_codes=[200, 429], error_message="Error updating item",
|
710
715
|
return_format="json")
|
711
716
|
if return_item == "Default":
|
712
|
-
|
713
|
-
|
714
|
-
|
717
|
+
warn(
|
718
|
+
message="Updating an item currently will make invoke an additional API call to get the item object. "
|
719
|
+
"The default behaviour of returning the item object will change in newer versions of the SDK. "
|
720
|
+
"To keep this behaviour, set return_item=True in the function call.",
|
721
|
+
category=FutureWarning,
|
722
|
+
stacklevel=2
|
723
|
+
)
|
715
724
|
if return_item:
|
716
725
|
return self.get_item_specific(workspace_id, resp_dict)
|
717
726
|
return resp_dict
|
@@ -2013,16 +2022,18 @@ class FabricClientCore(FabricClient):
|
|
2013
2022
|
response = self.calling_routine(url, operation="POST", body=body, response_codes=[202, 429],
|
2014
2023
|
error_message="Error loading table", return_format="response",
|
2015
2024
|
wait_for_completion=False)
|
2016
|
-
|
2025
|
+
|
2017
2026
|
if wait_for_completion:
|
2018
2027
|
success = self.check_if_table_is_created(workspace_id = workspace_id,
|
2019
2028
|
lakehouse_id = lakehouse_id,
|
2020
2029
|
table_name = table_name)
|
2021
|
-
|
2030
|
+
else:
|
2031
|
+
success = None
|
2032
|
+
|
2022
2033
|
if not success:
|
2023
|
-
|
2034
|
+
self._logger.warning("Table not created after 3 minutes")
|
2024
2035
|
else:
|
2025
|
-
|
2036
|
+
self._logger.info("Table created")
|
2026
2037
|
return response.status_code
|
2027
2038
|
|
2028
2039
|
# mlExperiments
|
@@ -2561,9 +2572,13 @@ class FabricClientCore(FabricClient):
|
|
2561
2572
|
error_message="Error updating workspace custom pool", return_format="json")
|
2562
2573
|
|
2563
2574
|
if return_item == "Default":
|
2564
|
-
|
2565
|
-
|
2566
|
-
|
2575
|
+
warn(
|
2576
|
+
message="Warning: Updating an item currently will make invoke an additional API call to get the item "
|
2577
|
+
"object. This default behaviour will change in newer versions of the SDK. To keep this "
|
2578
|
+
"behaviour, set return_item=True in the function call.",
|
2579
|
+
category=FutureWarning,
|
2580
|
+
stacklevel=2
|
2581
|
+
)
|
2567
2582
|
if return_item:
|
2568
2583
|
return self.get_workspace_custom_pool(workspace_id, pool_id)
|
2569
2584
|
return response_json
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import json
|
2
|
+
from warnings import warn
|
2
3
|
|
3
4
|
from msfabricpysdkcore.coreapi import FabricClientCore
|
4
5
|
|
@@ -46,7 +47,7 @@ class DeploymentPipeline:
|
|
46
47
|
|
47
48
|
|
48
49
|
def get_stages(self):
|
49
|
-
|
50
|
+
warn("DEPRECATED: Use list_stages() instead", DeprecationWarning, stacklevel=2)
|
50
51
|
return self.list_stages(self)
|
51
52
|
|
52
53
|
def list_stages(self):
|
@@ -54,13 +55,14 @@ class DeploymentPipeline:
|
|
54
55
|
|
55
56
|
|
56
57
|
def get_deployment_pipeline_stages_items(self, stage_id = None, stage_name = None):
|
57
|
-
|
58
|
+
warn("DEPRECATED: get_deployment_pipeline_stages_items. Use list_deployment_pipeline_stages_items() instead", DeprecationWarning, stacklevel=2)
|
58
59
|
return self.list_deployment_pipeline_stages_items(stage_id=stage_id, stage_name=stage_name)
|
59
60
|
|
60
61
|
|
61
62
|
def list_deployment_pipeline_stages_items(self, stage_id = None, stage_name = None):
|
62
63
|
return self.core_client.list_deployment_pipeline_stages_items(deployment_pipeline_id=self.id, stage_id=stage_id, stage_name=stage_name)
|
63
64
|
|
65
|
+
|
64
66
|
class Deployment_Pipeline_Stage():
|
65
67
|
|
66
68
|
"""Class to represent a deployment pipeline stage in Microsoft Fabric"""
|
@@ -120,7 +122,7 @@ class Deployment_Pipeline_Stage():
|
|
120
122
|
return self.__str__()
|
121
123
|
|
122
124
|
def get_items(self):
|
123
|
-
|
125
|
+
warn("DEPRECATED: get_items. Use list_items() instead", DeprecationWarning, stacklevel=2)
|
124
126
|
return self.list_items()
|
125
127
|
|
126
128
|
def list_items(self):
|
@@ -1,14 +1,18 @@
|
|
1
|
+
from warnings import warn
|
2
|
+
|
1
3
|
from msfabricpysdkcore.client import FabricClient
|
2
4
|
|
3
5
|
|
4
6
|
class FabricAzureClient(FabricClient):
|
5
7
|
|
6
|
-
def __init__(self, tenant_id=None, client_id=None, client_secret=None, silent=
|
8
|
+
def __init__(self, tenant_id=None, client_id=None, client_secret=None, silent=None) -> None:
|
7
9
|
super().__init__(scope = "https://management.azure.com/",
|
8
10
|
tenant_id = tenant_id,
|
9
11
|
client_id = client_id,
|
10
|
-
client_secret = client_secret,
|
11
|
-
|
12
|
+
client_secret = client_secret,)
|
13
|
+
|
14
|
+
if silent is not None:
|
15
|
+
warn("The 'silent' parameter is deprecated and will be removed in a future version.", DeprecationWarning, stacklevel=2)
|
12
16
|
|
13
17
|
|
14
18
|
def check_name_availability(self, subscription_id, location, name, type = "Microsoft.Fabric/capacities"):
|
@@ -1,16 +1,23 @@
|
|
1
|
+
import logging
|
1
2
|
from time import sleep, time
|
2
3
|
from msfabricpysdkcore.coreapi import FabricClientCore
|
4
|
+
from msfabricpysdkcore.util import logger
|
5
|
+
|
3
6
|
|
4
7
|
class LongRunningOperation:
|
5
8
|
"""Class to represent a workspace in Microsoft Fabric"""
|
6
9
|
|
10
|
+
_logger: logging.Logger
|
11
|
+
|
7
12
|
def __init__(self, operation_id, core_client: FabricClientCore) -> None:
|
13
|
+
"""Initialize the LongRunningOperation object"""
|
14
|
+
|
15
|
+
self._logger = logger.getChild(__name__)
|
8
16
|
self.operation_id = operation_id
|
9
17
|
self.core_client = core_client
|
10
18
|
|
11
19
|
self.state = self.get_operation_state()["status"]
|
12
20
|
|
13
|
-
|
14
21
|
def get_operation_results(self):
|
15
22
|
return self.core_client.get_operation_results(operation_id=self.operation_id)
|
16
23
|
|
@@ -26,22 +33,24 @@ class LongRunningOperation:
|
|
26
33
|
if duration > 60:
|
27
34
|
|
28
35
|
if self.state == "Running":
|
29
|
-
|
36
|
+
self._logger.info(f"Operation did not complete after {duration} seconds")
|
30
37
|
return "Running"
|
31
|
-
raise
|
38
|
+
raise TimeoutError(f"Operation did not complete after {duration} seconds")
|
32
39
|
sleep(3)
|
33
40
|
return self.state
|
34
41
|
|
35
42
|
|
36
43
|
def check_long_running_operation(headers, core_client):
|
37
|
-
"""Check the status of a long
|
44
|
+
"""Check the status of a long-running operation"""
|
38
45
|
location = headers.get('Location', None)
|
39
46
|
operation_id = headers.get('x-ms-operation-id', None)
|
40
47
|
if location:
|
41
48
|
operation_id = location.split("/")[-1]
|
42
49
|
|
50
|
+
logger_ = logger.getChild(__name__)
|
51
|
+
|
43
52
|
if not operation_id:
|
44
|
-
|
53
|
+
logger_.info("Operation initiated, no operation id found")
|
45
54
|
return None
|
46
55
|
lro = LongRunningOperation(operation_id=operation_id, core_client=core_client)
|
47
56
|
lro.wait_for_completion()
|
@@ -0,0 +1,32 @@
|
|
1
|
+
import logging
|
2
|
+
import os
|
3
|
+
from warnings import simplefilter
|
4
|
+
|
5
|
+
# Initialize logger for msfabricpysdkcore
|
6
|
+
logger: logging.Logger = logging.getLogger()
|
7
|
+
|
8
|
+
_logger = logger.getChild(__name__)
|
9
|
+
|
10
|
+
# Ensure warnings are always shown
|
11
|
+
simplefilter('always', DeprecationWarning)
|
12
|
+
simplefilter('always', FutureWarning)
|
13
|
+
|
14
|
+
# Add a NullHandler by default (https://docs.python.org/3/howto/logging.html#configuring-logging-for-a-library)
|
15
|
+
logger.addHandler(logging.NullHandler())
|
16
|
+
|
17
|
+
# Add a handler to log to console if desired (based on FABRIC_SDK_DEBUG environment variable)
|
18
|
+
if os.environ.get('FABRIC_SDK_DEBUG'):
|
19
|
+
logging.captureWarnings(True)
|
20
|
+
logging.getLogger("urllib3").setLevel(logging.INFO)
|
21
|
+
logger.setLevel(logging.DEBUG)
|
22
|
+
console_handler: logging.StreamHandler = logging.StreamHandler()
|
23
|
+
console_formatter: logging.Formatter = logging.Formatter(
|
24
|
+
'%(asctime)s - %(name)s - %(levelname)s - %(message)s'
|
25
|
+
)
|
26
|
+
console_handler.setFormatter(console_formatter)
|
27
|
+
logger.addHandler(console_handler)
|
28
|
+
_logger.debug("Fabric SDK Debug mode. Logging to console enabled.")
|
29
|
+
|
30
|
+
_logger.debug("Logger initialized")
|
31
|
+
|
32
|
+
__all__ = ["logger"]
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: msfabricpysdkcore
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.3
|
4
4
|
Summary: A Python SDK for Microsoft Fabric
|
5
5
|
Author: Andreas Rederer
|
6
6
|
Project-URL: Homepage, https://github.com/DaSenf1860/ms-fabric-sdk-core
|
@@ -60,6 +60,7 @@ Currently it supports all Core APIs, Admin APIs, all item specific CRUD APIs and
|
|
60
60
|
- Lakehouse operations (Load table, list tables, run table maintenance)
|
61
61
|
- Spark Pool operations
|
62
62
|
- [Azure Resource Management APIs for Fabric capacities](#azure-resource-management-apis-for-fabric-capacities)
|
63
|
+
- [Logging](#logging)
|
63
64
|
|
64
65
|
It is planned to support also new APIs which are not released yet.
|
65
66
|
Also we have plans to support APIs to interact with Fabric capacities on the Azure Side.
|
@@ -744,7 +745,7 @@ resp = fac.check_name_availability(subscription_id, "westeurope", capacity_name_
|
|
744
745
|
# Create or update capacity
|
745
746
|
resp = fac.create_or_update_capacity(subscription_id, resource_group_name, capacity_name_new,
|
746
747
|
location="westeurope",
|
747
|
-
properties_administration={"members": ['
|
748
|
+
properties_administration={"members": ['hfds@afasf.com']},
|
748
749
|
sku = "F2")
|
749
750
|
|
750
751
|
# Get capacity
|
@@ -777,3 +778,18 @@ resp = fac.suspend_capacity(subscription_id, resource_group_name, capacity_name)
|
|
777
778
|
# Update capacity
|
778
779
|
resp = fac.update_capacity(subscription_id, resource_group_name, capacity_name, sku="F4")
|
779
780
|
```
|
781
|
+
|
782
|
+
### Logging
|
783
|
+
|
784
|
+
The SDK uses the Python logging module, following the logging settings of your application. You can set up logging in
|
785
|
+
your project like this:
|
786
|
+
|
787
|
+
```python
|
788
|
+
import logging
|
789
|
+
from msfabricpysdkcore import FabricClientCore
|
790
|
+
|
791
|
+
logging.basicConfig(level=logging.DEBUG)
|
792
|
+
fc = FabricClientCore() # The client will now log
|
793
|
+
```
|
794
|
+
|
795
|
+
You can also set the environment variable `FABRIC_SDK_DEBUG` to `1` to enable debug logging.
|
@@ -1,20 +1,20 @@
|
|
1
|
-
msfabricpysdkcore/__init__.py,sha256=
|
1
|
+
msfabricpysdkcore/__init__.py,sha256=ObRW5Q8IMqrvA6VH6zXSv3n01AzRCGjn5RojJXAR6VE,208
|
2
2
|
msfabricpysdkcore/admin_item.py,sha256=9L09Kb7kn7JW0bqVu1qPOMT6oHLduX4Q5_qhVJZTLxQ,3290
|
3
3
|
msfabricpysdkcore/admin_workspace.py,sha256=umNnIF8sf5Y8BDgfQdfG6sOZrQQc7RJINL9j8DPnm3c,3180
|
4
|
-
msfabricpysdkcore/adminapi.py,sha256=
|
5
|
-
msfabricpysdkcore/auth.py,sha256=
|
4
|
+
msfabricpysdkcore/adminapi.py,sha256=3G-NADppTDN3Tba7kp-bQ82DAHV0h4DPdRIEuiX82S0,26072
|
5
|
+
msfabricpysdkcore/auth.py,sha256=64HoKyK-iZtBpX4R6U6leg5NiDj9rYpNgDJpTXbPig4,3310
|
6
6
|
msfabricpysdkcore/capacity.py,sha256=Q_2-XrZtdf9F67fY0qU3D0ocEOGQq4KtIXAv9dXjQhI,1761
|
7
|
-
msfabricpysdkcore/client.py,sha256=
|
8
|
-
msfabricpysdkcore/coreapi.py,sha256=
|
9
|
-
msfabricpysdkcore/deployment_pipeline.py,sha256=
|
7
|
+
msfabricpysdkcore/client.py,sha256=CTnqkqMq5b37ZIxP4o6t37xjxTWdscV50el1XjaqOCo,7014
|
8
|
+
msfabricpysdkcore/coreapi.py,sha256=We-m09M8MiQ4vC9uKdEgwe4slmafH9E4i0YGZze5FuM,132119
|
9
|
+
msfabricpysdkcore/deployment_pipeline.py,sha256=2d7BqRPgfBiAlQOP4UfYLmFMM8xonSjPkJKhevIKGEY,5756
|
10
10
|
msfabricpysdkcore/domain.py,sha256=92IVvZ3jXHIT1a0zlTPD7uoQX6TcBBE_Y_b4dScxHSU,6949
|
11
11
|
msfabricpysdkcore/environment.py,sha256=4k2Le1mAQIrfcpNc3n1DbgdCzAldGTSTCbiDQGk0DlA,2784
|
12
12
|
msfabricpysdkcore/fabric_azure_capacity.py,sha256=7JxMp9weiKG_mDjlRK-88oIXr0kdG0pzv-Ouycf3fus,2808
|
13
|
-
msfabricpysdkcore/fabric_azure_client.py,sha256=
|
13
|
+
msfabricpysdkcore/fabric_azure_client.py,sha256=xZntbXtORmHtTyBi9ur8HlEohJBa-MP3Fi5GF3qANTA,10568
|
14
14
|
msfabricpysdkcore/item.py,sha256=3ixgRDTmrKXw82xl1MkaaOQ2986s2_DFEJQeUkKPcEU,6376
|
15
15
|
msfabricpysdkcore/job_instance.py,sha256=HXSUVoE4XaG2Ic5RYZ1Mx3ymiIarHDAnyjaXXY4Aj74,2381
|
16
16
|
msfabricpysdkcore/lakehouse.py,sha256=yIrzatWM9emPn-Y54Cg_ZdAydIWjxrpK65jIQ4SClgE,1703
|
17
|
-
msfabricpysdkcore/long_running_operation.py,sha256=
|
17
|
+
msfabricpysdkcore/long_running_operation.py,sha256=XTlsueSZKVFICxhx99geEQ6btZFlFb8-lssigmQ9c6Y,2133
|
18
18
|
msfabricpysdkcore/onelakeshortcut.py,sha256=H02wR6Z86qTEJOwVRMKz1Ou3K88Y9pfJa91vizjprvo,1661
|
19
19
|
msfabricpysdkcore/otheritems.py,sha256=rkIbF-LxUUZh0ZDqFiWeutMeIsBXw_R8UUCglIifWBQ,12024
|
20
20
|
msfabricpysdkcore/spark_custom_pool.py,sha256=YsEULaQG-FO507aPIb-4kk93ZWBmDZj6fbOEHYoyxHE,3188
|
@@ -48,8 +48,10 @@ msfabricpysdkcore/tests/test_spark.py,sha256=faoVF3AuUCyfk2PvVccPngafyAkhq2SAj87
|
|
48
48
|
msfabricpysdkcore/tests/test_sparkjobdefinition.py,sha256=SANfiOLgwKRGnQN9ArEwv0fyXM12glEn9BG4jIL4W-c,2838
|
49
49
|
msfabricpysdkcore/tests/test_warehouses.py,sha256=CKF2kJMe-JSOWWok3dR_hn5HNwz9GtKoYT4fP59mTPk,1813
|
50
50
|
msfabricpysdkcore/tests/test_workspaces_capacities.py,sha256=V5ePndbtLVyYNa8Kug1Ul0oOF-Jd6DXEl8PclgfLhuw,6822
|
51
|
-
msfabricpysdkcore
|
52
|
-
msfabricpysdkcore
|
53
|
-
msfabricpysdkcore-0.1.
|
54
|
-
msfabricpysdkcore-0.1.
|
55
|
-
msfabricpysdkcore-0.1.
|
51
|
+
msfabricpysdkcore/util/__init__.py,sha256=p-1dC4AurfKdIUppNVlRCIcmwHBTURqfgIwxcie3fEA,50
|
52
|
+
msfabricpysdkcore/util/logger.py,sha256=XXdeaqI-BhXZgacChKrWP88TPU4FTWvS8L0YWjCT54A,1166
|
53
|
+
msfabricpysdkcore-0.1.3.dist-info/LICENSE,sha256=1NrGuF-zOmzbwzk3iI6lsP9koyDeKO1B0-8OD_tTvOQ,1156
|
54
|
+
msfabricpysdkcore-0.1.3.dist-info/METADATA,sha256=ZaLwABHnPX5WEwMqjgcD63bw8taLRsWtxGYV7wEJbGw,23286
|
55
|
+
msfabricpysdkcore-0.1.3.dist-info/WHEEL,sha256=Wyh-_nZ0DJYolHNn1_hMa4lM7uDedD_RGVwbmTjyItk,91
|
56
|
+
msfabricpysdkcore-0.1.3.dist-info/top_level.txt,sha256=3iRonu6ptDGQN4Yl6G76XGM7xbFNsskiEHW-P2gMQGY,18
|
57
|
+
msfabricpysdkcore-0.1.3.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|