semantic-link-labs 0.11.3__py3-none-any.whl → 0.12.1__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.

Files changed (75) hide show
  1. {semantic_link_labs-0.11.3.dist-info → semantic_link_labs-0.12.1.dist-info}/METADATA +6 -4
  2. {semantic_link_labs-0.11.3.dist-info → semantic_link_labs-0.12.1.dist-info}/RECORD +75 -73
  3. sempy_labs/__init__.py +6 -0
  4. sempy_labs/_a_lib_info.py +1 -1
  5. sempy_labs/_authentication.py +85 -32
  6. sempy_labs/_capacities.py +2 -2
  7. sempy_labs/_capacity_migration.py +4 -4
  8. sempy_labs/_clear_cache.py +1 -1
  9. sempy_labs/_connections.py +107 -70
  10. sempy_labs/_dashboards.py +6 -2
  11. sempy_labs/_data_pipelines.py +1 -1
  12. sempy_labs/_dataflows.py +1 -1
  13. sempy_labs/_dax.py +3 -3
  14. sempy_labs/_delta_analyzer.py +4 -4
  15. sempy_labs/_delta_analyzer_history.py +1 -1
  16. sempy_labs/_deployment_pipelines.py +1 -1
  17. sempy_labs/_environments.py +1 -1
  18. sempy_labs/_eventhouses.py +9 -3
  19. sempy_labs/_eventstreams.py +1 -1
  20. sempy_labs/_external_data_shares.py +1 -1
  21. sempy_labs/_gateways.py +14 -7
  22. sempy_labs/_generate_semantic_model.py +7 -12
  23. sempy_labs/_git.py +1 -1
  24. sempy_labs/_graphQL.py +1 -1
  25. sempy_labs/_helper_functions.py +161 -54
  26. sempy_labs/_job_scheduler.py +12 -1
  27. sempy_labs/_kql_databases.py +1 -1
  28. sempy_labs/_kql_querysets.py +10 -2
  29. sempy_labs/_kusto.py +2 -2
  30. sempy_labs/_list_functions.py +1 -1
  31. sempy_labs/_managed_private_endpoints.py +1 -1
  32. sempy_labs/_mirrored_databases.py +40 -16
  33. sempy_labs/_mirrored_warehouses.py +1 -1
  34. sempy_labs/_ml_experiments.py +1 -1
  35. sempy_labs/_model_bpa.py +6 -6
  36. sempy_labs/_model_bpa_bulk.py +3 -3
  37. sempy_labs/_model_dependencies.py +1 -1
  38. sempy_labs/_mounted_data_factories.py +3 -3
  39. sempy_labs/_notebooks.py +2 -1
  40. sempy_labs/_query_scale_out.py +2 -2
  41. sempy_labs/_refresh_semantic_model.py +1 -1
  42. sempy_labs/_semantic_models.py +15 -3
  43. sempy_labs/_spark.py +1 -1
  44. sempy_labs/_sql.py +3 -3
  45. sempy_labs/_sql_endpoints.py +5 -3
  46. sempy_labs/_sqldatabase.py +5 -1
  47. sempy_labs/_tags.py +3 -1
  48. sempy_labs/_translations.py +7 -360
  49. sempy_labs/_user_delegation_key.py +2 -2
  50. sempy_labs/_utils.py +27 -0
  51. sempy_labs/_vertipaq.py +3 -3
  52. sempy_labs/_vpax.py +1 -1
  53. sempy_labs/_warehouses.py +5 -0
  54. sempy_labs/_workloads.py +1 -1
  55. sempy_labs/_workspace_identity.py +1 -1
  56. sempy_labs/_workspaces.py +145 -11
  57. sempy_labs/admin/__init__.py +6 -0
  58. sempy_labs/admin/_capacities.py +37 -14
  59. sempy_labs/admin/_items.py +2 -2
  60. sempy_labs/admin/_tenant_keys.py +89 -0
  61. sempy_labs/directlake/_dl_helper.py +1 -1
  62. sempy_labs/lakehouse/__init__.py +4 -0
  63. sempy_labs/lakehouse/_materialized_lake_views.py +76 -0
  64. sempy_labs/lakehouse/_shortcuts.py +8 -2
  65. sempy_labs/report/_download_report.py +4 -1
  66. sempy_labs/report/_export_report.py +12 -5
  67. sempy_labs/report/_generate_report.py +11 -3
  68. sempy_labs/report/_paginated.py +21 -15
  69. sempy_labs/report/_report_functions.py +19 -11
  70. sempy_labs/report/_report_rebind.py +56 -33
  71. sempy_labs/theme/_org_themes.py +5 -6
  72. sempy_labs/tom/_model.py +5 -16
  73. {semantic_link_labs-0.11.3.dist-info → semantic_link_labs-0.12.1.dist-info}/WHEEL +0 -0
  74. {semantic_link_labs-0.11.3.dist-info → semantic_link_labs-0.12.1.dist-info}/licenses/LICENSE +0 -0
  75. {semantic_link_labs-0.11.3.dist-info → semantic_link_labs-0.12.1.dist-info}/top_level.txt +0 -0
@@ -3,7 +3,7 @@ import pandas as pd
3
3
  import json
4
4
  import os
5
5
  from typing import Optional
6
- from .._helper_functions import (
6
+ from sempy_labs._helper_functions import (
7
7
  resolve_workspace_name_and_id,
8
8
  _conv_b64,
9
9
  resolve_dataset_name_and_id,
@@ -11,7 +11,7 @@ from .._helper_functions import (
11
11
  _update_dataframe_datatypes,
12
12
  _base_api,
13
13
  resolve_item_id,
14
- get_item_definition,
14
+ _get_item_definition,
15
15
  )
16
16
  import sempy_labs._icons as icons
17
17
  from sempy._utils._log import log
@@ -31,6 +31,8 @@ def create_report_from_reportjson(
31
31
 
32
32
  This is a wrapper function for the following API: `Items - Create Report <https://learn.microsoft.com/rest/api/fabric/report/items/create-report>`_.
33
33
 
34
+ Service Principal Authentication is supported (see `here <https://github.com/microsoft/semantic-link-labs/blob/main/notebooks/Service%20Principal.ipynb>`_ for examples).
35
+
34
36
  Parameters
35
37
  ----------
36
38
  report : str
@@ -113,6 +115,7 @@ def create_report_from_reportjson(
113
115
  payload=request_body,
114
116
  lro_return_status_code=True,
115
117
  status_codes=[201, 202],
118
+ client="fabric_sp",
116
119
  )
117
120
 
118
121
  print(
@@ -129,6 +132,8 @@ def update_report_from_reportjson(
129
132
 
130
133
  This is a wrapper function for the following API: `Items - Update Report Definition <https://learn.microsoft.com/rest/api/fabric/report/items/update-report-definition>`_.
131
134
 
135
+ Service Principal Authentication is supported (see `here <https://github.com/microsoft/semantic-link-labs/blob/main/notebooks/Service%20Principal.ipynb>`_ for examples).
136
+
132
137
  Parameters
133
138
  ----------
134
139
  report : str | uuid.UUID
@@ -173,6 +178,7 @@ def update_report_from_reportjson(
173
178
  payload=payload,
174
179
  lro_return_status_code=True,
175
180
  status_codes=None,
181
+ client="fabric_sp",
176
182
  )
177
183
 
178
184
  print(
@@ -191,6 +197,8 @@ def get_report_definition(
191
197
 
192
198
  This is a wrapper function for the following API: `Items - Get Report Definition <https://learn.microsoft.com/rest/api/fabric/report/items/get-report-definition>`_.
193
199
 
200
+ Service Principal Authentication is supported (see `here <https://github.com/microsoft/semantic-link-labs/blob/main/notebooks/Service%20Principal.ipynb>`_ for examples).
201
+
194
202
  Parameters
195
203
  ----------
196
204
  report : str | uuid.UUID
@@ -208,7 +216,7 @@ def get_report_definition(
208
216
  The collection of report definition files within a pandas dataframe.
209
217
  """
210
218
 
211
- return get_item_definition(
219
+ return _get_item_definition(
212
220
  item=report,
213
221
  type="Report",
214
222
  workspace=workspace,
@@ -1,8 +1,8 @@
1
1
  from typing import Optional
2
2
  import pandas as pd
3
3
  from uuid import UUID
4
- from .._helper_functions import (
5
- resolve_workspace_name_and_id,
4
+ from sempy_labs._helper_functions import (
5
+ resolve_workspace_id,
6
6
  _base_api,
7
7
  resolve_item_id,
8
8
  _create_dataframe,
@@ -18,6 +18,8 @@ def get_report_datasources(
18
18
  """
19
19
  Returns a list of data sources for the specified paginated report (RDL) from the specified workspace.
20
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
+
21
23
  Parameters
22
24
  ----------
23
25
  report : str | uuid.UUID
@@ -44,27 +46,31 @@ def get_report_datasources(
44
46
  }
45
47
  df = _create_dataframe(columns=columns)
46
48
 
47
- (workspace_name, workspace_id) = resolve_workspace_name_and_id(workspace)
49
+ workspace_id = resolve_workspace_id(workspace)
48
50
  report_id = resolve_item_id(
49
51
  item=report, type="PaginatedReport", workspace=workspace
50
52
  )
51
53
 
52
54
  response = _base_api(
53
- request=f"v1.0/myorg/groups/{workspace_id}/reports/{report_id}/datasources"
55
+ request=f"v1.0/myorg/groups/{workspace_id}/reports/{report_id}/datasources",
56
+ client="fabric_sp",
54
57
  )
55
58
 
59
+ rows = []
56
60
  for i in response.json().get("value", []):
57
61
  conn = i.get("connectionDetails", {})
58
- new_data = {
59
- "Report Name": report,
60
- "Report Id": report_id,
61
- "Datasource Id": i.get("datasourceId"),
62
- "Datasource Type": i.get("datasourceType"),
63
- "Gateway Id": i.get("gatewayId"),
64
- "Server": conn.get("server") if conn else None,
65
- "Database": conn.get("database") if conn else None,
66
- }
67
-
68
- df = pd.concat([df, pd.DataFrame(new_data, index=[0])], ignore_index=True)
62
+ rows.append(
63
+ {
64
+ "Report Name": report,
65
+ "Report Id": report_id,
66
+ "Datasource Id": i.get("datasourceId"),
67
+ "Datasource Type": i.get("datasourceType"),
68
+ "Gateway Id": i.get("gatewayId"),
69
+ "Server": conn.get("server") if conn else None,
70
+ "Database": conn.get("database") if conn else None,
71
+ }
72
+ )
73
+ if rows:
74
+ df = pd.DataFrame(rows, columns=list(columns.keys()))
69
75
 
70
76
  return df
@@ -19,6 +19,7 @@ from .._helper_functions import (
19
19
  _create_spark_session,
20
20
  _mount,
21
21
  resolve_workspace_id,
22
+ resolve_item_name_and_id,
22
23
  )
23
24
  from typing import List, Optional, Union
24
25
  from sempy._utils._log import log
@@ -33,14 +34,14 @@ def get_report_json(
33
34
  save_to_file_name: Optional[str] = None,
34
35
  ) -> dict:
35
36
  """
36
- Gets the report.json file content of a Power BI report.
37
+ Gets the report.json file content of a Power BI report. This function only supports reports in the PBIR-Legacy format.
37
38
 
38
39
  This is a wrapper function for the following API: `Items - Get Report Definition <https://learn.microsoft.com/rest/api/fabric/report/items/get-report-definition>`_.
39
40
 
40
41
  Parameters
41
42
  ----------
42
- report : str
43
- Name of the Power BI report.
43
+ report : str | uuid.UUID
44
+ Name or ID of the Power BI report.
44
45
  workspace : str | uuid.UUID, default=None
45
46
  The Fabric workspace name or ID in which the report exists.
46
47
  Defaults to None which resolves to the workspace of the attached lakehouse
@@ -55,20 +56,27 @@ def get_report_json(
55
56
  """
56
57
 
57
58
  (workspace_name, workspace_id) = resolve_workspace_name_and_id(workspace)
58
- report_id = resolve_report_id(report=report, workspace=workspace_id)
59
- fmt = "PBIR-Legacy"
59
+ (report_name, report_id) = resolve_item_name_and_id(
60
+ item=report, type="Report", workspace=workspace_id
61
+ )
60
62
 
61
63
  result = _base_api(
62
- request=f"/v1/workspaces/{workspace_id}/reports/{report_id}/getDefinition?format={fmt}",
64
+ request=f"/v1/workspaces/{workspace_id}/reports/{report_id}/getDefinition",
63
65
  method="post",
64
66
  lro_return_json=True,
65
67
  status_codes=None,
66
68
  )
67
- df_items = pd.json_normalize(result["definition"]["parts"])
68
- df_items_filt = df_items[df_items["path"] == "report.json"]
69
- payload = df_items_filt["payload"].iloc[0]
70
- report_file = _decode_b64(payload)
71
- report_json = json.loads(report_file)
69
+ report_json = None
70
+ for part in result.get("definition", {}).get("parts", {}):
71
+ if part.get("path") == "report.json":
72
+ payload = part.get("payload")
73
+ report_file = _decode_b64(payload)
74
+ report_json = json.loads(report_file)
75
+
76
+ if not report_json:
77
+ raise ValueError(
78
+ f"{icons.red_dot} Unable to retrieve report.json for the '{report_name}' report within the '{workspace_name}' workspace. This function only supports reports in the PBIR-Legacy format."
79
+ )
72
80
 
73
81
  if save_to_file_name is not None:
74
82
  if not lakehouse_attached():
@@ -1,7 +1,6 @@
1
- from .._helper_functions import (
2
- resolve_dataset_id,
1
+ from sempy_labs._helper_functions import (
3
2
  resolve_workspace_name_and_id,
4
- resolve_report_id,
3
+ resolve_item_name_and_id,
5
4
  _base_api,
6
5
  resolve_dataset_name_and_id,
7
6
  )
@@ -13,8 +12,8 @@ from uuid import UUID
13
12
 
14
13
  @log
15
14
  def report_rebind(
16
- report: str | List[str],
17
- dataset: str,
15
+ report: str | UUID | List[str | UUID],
16
+ dataset: str | UUID,
18
17
  report_workspace: Optional[str | UUID] = None,
19
18
  dataset_workspace: Optional[str | UUID] = None,
20
19
  ):
@@ -23,12 +22,14 @@ def report_rebind(
23
22
 
24
23
  This is a wrapper function for the following API: `Reports - Rebind Report In Group <https://learn.microsoft.com/rest/api/power-bi/reports/rebind-report-in-group>`_.
25
24
 
25
+ Service Principal Authentication is supported (see `here <https://github.com/microsoft/semantic-link-labs/blob/main/notebooks/Service%20Principal.ipynb>`_ for examples).
26
+
26
27
  Parameters
27
28
  ----------
28
- report : str | List[str]
29
- Name(s) of the Power BI report(s).
30
- dataset : str
31
- Name of the semantic model.
29
+ report : str | uuid.UUID | List[str | uuid.UUID]
30
+ Name(s) or ID(s) of the Power BI report(s).
31
+ dataset : str | uuid.UUID
32
+ Name or ID of the semantic model.
32
33
  report_workspace : str | uuid.UUID, default=None
33
34
  The name or ID of the Fabric workspace in which the report resides.
34
35
  Defaults to None which resolves to the workspace of the attached lakehouse
@@ -46,12 +47,19 @@ def report_rebind(
46
47
  if dataset_workspace is None:
47
48
  dataset_workspace = report_workspace_name
48
49
 
50
+ (dataset_workspace_name, dataset_workspace_id) = resolve_workspace_name_and_id(
51
+ dataset_workspace
52
+ )
49
53
  if isinstance(report, str):
50
54
  report = [report]
51
55
 
52
56
  for rpt in report:
53
- report_id = resolve_report_id(report=rpt, workspace=report_workspace_id)
54
- dataset_id = resolve_dataset_id(dataset=dataset, workspace=dataset_workspace)
57
+ (report_name, report_id) = resolve_item_name_and_id(
58
+ item=rpt, type="Report", workspace=report_workspace_id
59
+ )
60
+ (dataset_name, dataset_id) = resolve_item_name_and_id(
61
+ item=dataset, type="SemanticModel", workspace=dataset_workspace
62
+ )
55
63
 
56
64
  payload = {"datasetId": dataset_id}
57
65
 
@@ -59,54 +67,60 @@ def report_rebind(
59
67
  request=f"v1.0/myorg/groups/{report_workspace_id}/reports/{report_id}/Rebind",
60
68
  method="post",
61
69
  payload=payload,
70
+ client="fabric_sp",
62
71
  )
63
72
 
64
73
  print(
65
- f"{icons.green_dot} The '{rpt}' report has been successfully rebinded to the '{dataset}' semantic model."
74
+ f"{icons.green_dot} The '{report_name}' report within the '{report_workspace_name}' workspace has been successfully rebinded to the '{dataset_name}' semantic model within the '{dataset_workspace_name}' workspace."
66
75
  )
67
76
 
68
77
 
69
78
  @log
70
79
  def report_rebind_all(
71
- dataset: str,
72
- new_dataset: str,
73
- dataset_workspace: Optional[str] = None,
74
- new_dataset_workpace: Optional[str] = None,
75
- report_workspace: Optional[str | List[str]] = None,
80
+ dataset: str | UUID,
81
+ new_dataset: str | UUID,
82
+ dataset_workspace: Optional[str | UUID] = None,
83
+ new_dataset_workspace: Optional[str | UUID] = None,
84
+ report_workspace: Optional[str | UUID | List[str | UUID]] = None,
76
85
  ):
77
86
  """
78
- Rebinds all reports across all workspaces which are bound to a specific semantic model to a new semantic model.
87
+ Rebinds all reports across the provided report workspaces which are bound to a specific semantic model to a new semantic model.
88
+
89
+ Service Principal Authentication is supported (see `here <https://github.com/microsoft/semantic-link-labs/blob/main/notebooks/Service%20Principal.ipynb>`_ for examples).
79
90
 
80
91
  Parameters
81
92
  ----------
82
- dataset : str
93
+ dataset : str | uuid.UUID
83
94
  Name of the semantic model currently binded to the reports.
84
- new_dataset : str
95
+ new_dataset : str | uuid.UUID
85
96
  Name of the semantic model to rebind to the reports.
86
- dataset_workspace : str, default=None
97
+ dataset_workspace : str | uuid.UUID, default=None
87
98
  The name of the Fabric workspace in which the original semantic model resides.
88
99
  Defaults to None which resolves to the workspace of the attached lakehouse
89
100
  or if no lakehouse attached, resolves to the workspace of the notebook.
90
- new_dataset_workspace : str, default=None
101
+ new_dataset_workspace : str | uuid.UUID, default=None
91
102
  The name of the Fabric workspace in which the new semantic model resides.
92
103
  Defaults to None which resolves to the workspace of the attached lakehouse
93
104
  or if no lakehouse attached, resolves to the workspace of the notebook.
94
- report_workspace : str | List[str], default=None
95
- The name(s) of the Fabric workspace(s) in which the report(s) reside(s).
105
+ report_workspace : str | uuid.UUID | List[str | uuid.UUID], default=None
106
+ The name(s) or IDs of the Fabric workspace(s) in which the report(s) reside(s).
96
107
  Defaults to None which finds all reports in all workspaces which use the semantic model and rebinds them to
97
108
  the new semantic model.
98
109
  """
99
110
 
100
111
  from sempy_labs._list_functions import list_reports_using_semantic_model
101
112
 
102
- if dataset == new_dataset:
103
- raise ValueError(
104
- f"{icons.red_dot} The 'dataset' and 'new_dataset' parameters are both set to '{dataset}'. These parameters must be set to different values."
105
- )
106
-
107
113
  (dataset_name, dataset_id) = resolve_dataset_name_and_id(
108
114
  dataset=dataset, workspace=dataset_workspace
109
115
  )
116
+ (new_dataset_name, new_dataset_id) = resolve_dataset_name_and_id(
117
+ dataset=new_dataset, workspace=new_dataset_workspace
118
+ )
119
+
120
+ if dataset_id == new_dataset_id:
121
+ raise ValueError(
122
+ f"{icons.red_dot} The 'dataset' and 'new_dataset' parameters are both set to '{dataset}'. These parameters must be set to different values."
123
+ )
110
124
  (dataset_workspace_name, dataset_workspace_id) = resolve_workspace_name_and_id(
111
125
  workspace=dataset_workspace
112
126
  )
@@ -118,7 +132,7 @@ def report_rebind_all(
118
132
  dataset=dataset, workspace=dataset_workspace
119
133
  )
120
134
 
121
- if len(dfR) == 0:
135
+ if dfR.empty:
122
136
  print(
123
137
  f"{icons.info} The '{dataset_name}' semantic model within the '{dataset_workspace_name}' workspace has no dependent reports."
124
138
  )
@@ -127,9 +141,18 @@ def report_rebind_all(
127
141
  if report_workspace is None:
128
142
  dfR_filt = dfR.copy()
129
143
  else:
130
- dfR_filt = dfR[dfR["Report Workspace Name"].isin(report_workspace)]
144
+ dfR_filt = dfR[
145
+ (dfR["Report Workspace Name"].isin(report_workspace))
146
+ | (dfR["Report Workspace ID"].isin(report_workspace))
147
+ ]
148
+
149
+ if dfR_filt.empty:
150
+ print(
151
+ f"{icons.info} No reports found for the '{dataset_name}' semantic model within the '{dataset_workspace_name}' workspace."
152
+ )
153
+ return
131
154
 
132
- for i, r in dfR_filt.iterrows():
155
+ for _, r in dfR_filt.iterrows():
133
156
  rpt_name = r["Report Name"]
134
157
  rpt_wksp = r["Report Workspace Name"]
135
158
 
@@ -137,5 +160,5 @@ def report_rebind_all(
137
160
  report=rpt_name,
138
161
  dataset=new_dataset,
139
162
  report_workspace=rpt_wksp,
140
- dataset_workspace=new_dataset_workpace,
163
+ dataset_workspace=new_dataset_workspace,
141
164
  )
@@ -1,6 +1,6 @@
1
1
  import pandas as pd
2
2
  from uuid import UUID
3
- from .._helper_functions import (
3
+ from sempy_labs._helper_functions import (
4
4
  _is_valid_uuid,
5
5
  _base_api,
6
6
  _update_dataframe_datatypes,
@@ -9,6 +9,7 @@ from .._helper_functions import (
9
9
 
10
10
 
11
11
  _pbi_url_prefix = None
12
+ _theme_url_prefix = "metadata/v202409/organization/themes"
12
13
 
13
14
 
14
15
  def init_pbi_url_prefix():
@@ -44,7 +45,7 @@ def list_org_themes() -> pd.DataFrame:
44
45
 
45
46
  df = _create_dataframe(columns=columns)
46
47
 
47
- response = _base_api(request=f"{_pbi_url_prefix}/metadata/organization/themes")
48
+ response = _base_api(request=f"{_pbi_url_prefix}/{_theme_url_prefix}")
48
49
 
49
50
  result = response.json().get("orgThemes")
50
51
  if result:
@@ -110,9 +111,7 @@ def get_org_theme_json(theme: str | UUID) -> dict:
110
111
  init_pbi_url_prefix()
111
112
 
112
113
  theme_id = resolve_theme_id(theme)
113
- response = _base_api(
114
- request=f"{_pbi_url_prefix}/metadata/organization/themes/{theme_id}"
115
- )
114
+ response = _base_api(request=f"{_pbi_url_prefix}/{_theme_url_prefix}/{theme_id}")
116
115
  return response.json().get("themeJson", {})
117
116
 
118
117
 
@@ -124,7 +123,7 @@ def delete_org_theme(theme: str | UUID) -> None:
124
123
 
125
124
  theme_id = resolve_theme_id(theme)
126
125
  _base_api(
127
- request=f"{_pbi_url_prefix}/metadata/organization/themes/{theme_id}",
126
+ request=f"{_pbi_url_prefix}/{_theme_url_prefix}/{theme_id}",
128
127
  method="delete",
129
128
  status_codes=204,
130
129
  )
sempy_labs/tom/_model.py CHANGED
@@ -5127,25 +5127,14 @@ class TOMWrapper:
5127
5127
  Generates the M expression for the import partition.
5128
5128
  """
5129
5129
 
5130
- if artifact_type == "Lakehouse":
5131
- type_id = "lakehouseId"
5132
- elif artifact_type == "Warehouse":
5133
- type_id = "warehouseId"
5134
- else:
5135
- raise NotImplementedError
5136
-
5137
5130
  full_table_name = (
5138
- f"{schema_name}.{table_name}" if schema_name else table_name
5131
+ f"{schema_name}/{table_name}" if schema_name else table_name
5139
5132
  )
5140
5133
 
5141
- return f"""let
5142
- Source = {artifact_type}.Contents(null),
5143
- #"Workspace" = Source{{[workspaceId="{workspace_id}"]}}[Data],
5144
- #"Artifact" = #"Workspace"{{[{type_id}="{artifact_id}"]}}[Data],
5145
- result = #"Artifact"{{[Id="{full_table_name}",ItemKind="Table"]}}[Data]
5146
- in
5147
- result
5148
- """
5134
+ return f"""let\n\tSource = AzureStorage.DataLake("https://onelake.dfs.fabric.microsoft.com/{workspace_id}/{artifact_id}", [HierarchicalNavigation=true]),
5135
+ Tables = Source{{[Name = "Tables"]}}[Content],
5136
+ ExpressionTable = Tables{{[Name = "{full_table_name}"]}}[Content],
5137
+ ToDelta = DeltaLake.Table(ExpressionTable)\nin\n\tToDelta"""
5149
5138
 
5150
5139
  m_expression = _generate_m_expression(
5151
5140
  source_workspace_id,