msfabricpysdkcore 0.0.7__py3-none-any.whl → 0.0.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.
msfabricpysdkcore/auth.py CHANGED
@@ -1,7 +1,10 @@
1
1
  import requests
2
2
  from abc import abstractmethod
3
3
  from azure.identity import AzureCliCredential
4
-
4
+ try:
5
+ from notebookutils import mssparkutils
6
+ except ImportError:
7
+ pass
5
8
  class FabricAuth():
6
9
  """FabricAuth class to interact with Entra ID"""
7
10
 
@@ -58,4 +61,17 @@ class FabricServicePrincipal(FabricAuth):
58
61
  response = requests.post(url, data=payload)
59
62
  access_token = response.json().get('access_token')
60
63
  return access_token
61
-
64
+
65
+ class FabricSparkUtilsAuthentication(FabricAuth):
66
+ """FabricSparkUtilsAuthentication class to interact with Entra ID"""
67
+
68
+ def __init__(self):
69
+ mssparkutils.credentials.getToken("pbi")
70
+ print("Using Synapse Spark Utils for authentication")
71
+
72
+ def get_token(self):
73
+ """Get token from Azure AD"""
74
+ token = mssparkutils.credentials.getToken("pbi")
75
+ return token
76
+
77
+
@@ -1,7 +1,7 @@
1
1
  import os
2
2
  from time import sleep
3
3
 
4
- from msfabricpysdkcore.auth import FabricAuthClient, FabricServicePrincipal
4
+ from msfabricpysdkcore.auth import FabricAuthClient, FabricServicePrincipal, FabricSparkUtilsAuthentication
5
5
 
6
6
  class FabricClient():
7
7
  """FabricClient class to interact with Fabric API"""
@@ -12,11 +12,14 @@ class FabricClient():
12
12
  self.client_id = client_id if client_id else os.getenv("FABRIC_CLIENT_ID")
13
13
  self.client_secret = client_secret if client_secret else os.getenv("FABRIC_CLIENT_SECRET")
14
14
 
15
+ self.scope = "https://api.fabric.microsoft.com/.default"
16
+
15
17
  if self.client_id is None or self.client_secret is None or self.tenant_id is None:
16
- self.auth = FabricAuthClient()
18
+ try:
19
+ self.auth = FabricSparkUtilsAuthentication()
20
+ except:
21
+ self.auth = FabricAuthClient()
17
22
  else:
18
23
  self.auth = FabricServicePrincipal(tenant_id = self.tenant_id,
19
24
  client_id = self.client_id,
20
- client_secret = self.client_secret)
21
-
22
- self.scope = "https://api.fabric.microsoft.com/.default"
25
+ client_secret = self.client_secret)
@@ -302,8 +302,8 @@ class TestFabricClientCore(unittest.TestCase):
302
302
  fc = self.fc
303
303
  workspace = fc.get_workspace_by_name("testitems")
304
304
  workspace_id = workspace.id
305
-
306
- model_name = "mlmodel12345"
305
+ datetime_str = datetime.now().strftime("%Y%m%d%H%M%S")
306
+ model_name = "mlm" + datetime_str
307
307
 
308
308
  ml_model = fc.create_ml_model(workspace_id, display_name=model_name)
309
309
  self.assertEqual(ml_model.display_name, model_name)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: msfabricpysdkcore
3
- Version: 0.0.7
3
+ Version: 0.0.9
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
@@ -24,7 +24,7 @@ They are designed to automate your Fabric processes.
24
24
 
25
25
  This SDK helps to interact with the Fabric APIs in a more Pythonic way.
26
26
  Additionally it brings some extra features like:
27
- - Authentication is handled for you (currently Azure CLI Authentication and Service Principal Authentication are supported)
27
+ - Authentication is handled for you (currently Azure CLI Authentication and Service Principal Authentication are supported, as well as Synapse Spark Authentication in Fabric Notebooks)
28
28
  - Waiting for completion of long running operations
29
29
  - Retry logic when hitting the API rate limits
30
30
  - Referencing objects by name instead of ID
@@ -2,9 +2,9 @@ msfabricpysdkcore/__init__.py,sha256=nh8-lxdMBWYSbQpbRxWkn3ZRpGipmQplTudjskN2l88
2
2
  msfabricpysdkcore/admin_item.py,sha256=YfZiNAwqojwxSLsHXmYG_uO6_ILIQqLsOVh79HeWsuw,3778
3
3
  msfabricpysdkcore/admin_workspace.py,sha256=OtBI7EWOa44rgIdIDG9dU2l-nMRYpOeIaoP5BPHKUPA,4248
4
4
  msfabricpysdkcore/adminapi.py,sha256=YzK3s-CoFkzwOXrWPxoUeXFpv16ZwNujieaZI63bhqI,21039
5
- msfabricpysdkcore/auth.py,sha256=1t5prgSg2hK7vMutif2lxHOQk_qTo3152h3FMof3y_4,1929
5
+ msfabricpysdkcore/auth.py,sha256=zOU3viJwwYZMefS2yWJZ_LaOePJY8mRRrACIlp0yRkw,2430
6
6
  msfabricpysdkcore/capacity.py,sha256=Q_2-XrZtdf9F67fY0qU3D0ocEOGQq4KtIXAv9dXjQhI,1761
7
- msfabricpysdkcore/client.py,sha256=XVa9xndx-b2f7rA8zR-9fXyon1Ig1MmSwIMNXDfUdhw,1060
7
+ msfabricpysdkcore/client.py,sha256=W8J5VR19e6N__ycLvFALo-IHWDznGr5s7YD6e9jC4bE,1197
8
8
  msfabricpysdkcore/coreapi.py,sha256=PhcCP2JaR5-1FGHhgHKwb0sUFECi9iQ0BPe_Jewb3nE,32048
9
9
  msfabricpysdkcore/domain.py,sha256=i8jMJEutDRL5XuQ69woCVQEzLS_lm9uUxl4Kp3xtxHc,14722
10
10
  msfabricpysdkcore/item.py,sha256=NTWekAjo9YJUapH1F4E3x-jRJoEzQwOuq9Ya2JEt54w,11570
@@ -18,12 +18,12 @@ msfabricpysdkcore/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG
18
18
  msfabricpysdkcore/tests/test_admin_apis.py,sha256=9tIknq_a2RXy4mU1tYQXmMmZlmFrtYQhCQjN0a2dRv8,2048
19
19
  msfabricpysdkcore/tests/test_domains.py,sha256=pmdCTjd8zUDll0fjsoYUvqgfq0n4CpVBdyzw-7L3Glw,4635
20
20
  msfabricpysdkcore/tests/test_git.py,sha256=qqnOYM373hx8fb36ME98Jl-rhGK6cC_nIUjflFvtkUo,2399
21
- msfabricpysdkcore/tests/test_items_incl_lakehouse.py,sha256=4AtsLBePHZ_uGX1hRf1gNfuLm7xxyrP--cTbBbGvs6w,21117
21
+ msfabricpysdkcore/tests/test_items_incl_lakehouse.py,sha256=tIEXvkeMjd3QlPxVrumRLghndYYzEdk1SIZSRPp2ilo,21185
22
22
  msfabricpysdkcore/tests/test_jobs.py,sha256=G3edmNO9FpRgaVnG3RR_MTtxfSTLhp05-HBKWsRNJF8,1581
23
23
  msfabricpysdkcore/tests/test_shortcuts.py,sha256=BZKIQxkYrlnsqCgEIHqqTBszOnUWyTg_k20DueKZB-I,2391
24
24
  msfabricpysdkcore/tests/test_workspaces_capacities.py,sha256=WWHlSL8yMTfBer8QoOpsgQFuvIOb3xroVd3oaJpf3X8,6549
25
- msfabricpysdkcore-0.0.7.dist-info/LICENSE,sha256=1NrGuF-zOmzbwzk3iI6lsP9koyDeKO1B0-8OD_tTvOQ,1156
26
- msfabricpysdkcore-0.0.7.dist-info/METADATA,sha256=WCOdWEdyxil4oZpGSrUE_YBZY_jUzTL80zmsVSTDoiM,16385
27
- msfabricpysdkcore-0.0.7.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
28
- msfabricpysdkcore-0.0.7.dist-info/top_level.txt,sha256=3iRonu6ptDGQN4Yl6G76XGM7xbFNsskiEHW-P2gMQGY,18
29
- msfabricpysdkcore-0.0.7.dist-info/RECORD,,
25
+ msfabricpysdkcore-0.0.9.dist-info/LICENSE,sha256=1NrGuF-zOmzbwzk3iI6lsP9koyDeKO1B0-8OD_tTvOQ,1156
26
+ msfabricpysdkcore-0.0.9.dist-info/METADATA,sha256=e4wS-QqGgHZAEKewmN2QrMbDVdzIovJt8-rESB6hmVg,16445
27
+ msfabricpysdkcore-0.0.9.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
28
+ msfabricpysdkcore-0.0.9.dist-info/top_level.txt,sha256=3iRonu6ptDGQN4Yl6G76XGM7xbFNsskiEHW-P2gMQGY,18
29
+ msfabricpysdkcore-0.0.9.dist-info/RECORD,,