duckrun 0.2.5.dev2__py3-none-any.whl → 0.2.5.dev4__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.
duckrun/core.py CHANGED
@@ -441,6 +441,26 @@ class Duckrun:
441
441
  print(f"❌ Error attaching lakehouse: {e}")
442
442
  print("Continuing without pre-attached tables.")
443
443
 
444
+ def get_workspace_id(self) -> str:
445
+ """
446
+ Get the workspace ID (GUID or name without spaces).
447
+ Use this when passing workspace parameter to Python functions.
448
+
449
+ Returns:
450
+ Workspace ID - either a GUID or workspace name without spaces
451
+ """
452
+ return self.workspace_id
453
+
454
+ def get_lakehouse_id(self) -> str:
455
+ """
456
+ Get the lakehouse ID (GUID or name).
457
+ Use this when passing lakehouse parameter to Python functions.
458
+
459
+ Returns:
460
+ Lakehouse ID - either a GUID or lakehouse name
461
+ """
462
+ return self.lakehouse_id
463
+
444
464
  def run(self, pipeline: List[Tuple]) -> bool:
445
465
  """
446
466
  Execute pipeline of tasks.
@@ -702,7 +722,11 @@ class WorkspaceConnection:
702
722
  try:
703
723
  import notebookutils # type: ignore
704
724
  token = notebookutils.credentials.getToken("pbi")
705
- workspace_id = notebookutils.runtime.context.get("workspaceId")
725
+ # Always resolve workspace name to ID, even in notebook environment
726
+ workspace_id = self._get_workspace_id_by_name(token, self.workspace_name)
727
+ if not workspace_id:
728
+ print(f"Workspace '{self.workspace_name}' not found")
729
+ return []
706
730
  except ImportError:
707
731
  # Fallback to azure-identity
708
732
  print("Getting authentication token...")
@@ -749,7 +773,11 @@ class WorkspaceConnection:
749
773
  try:
750
774
  import notebookutils # type: ignore
751
775
  token = notebookutils.credentials.getToken("pbi")
752
- workspace_id = notebookutils.runtime.context.get("workspaceId")
776
+ # Always resolve workspace name to ID, even in notebook environment
777
+ workspace_id = self._get_workspace_id_by_name(token, self.workspace_name)
778
+ if not workspace_id:
779
+ print(f"Workspace '{self.workspace_name}' not found")
780
+ return False
753
781
  except ImportError:
754
782
  # Fallback to azure-identity
755
783
  print("Getting authentication token...")
duckrun/runner.py CHANGED
@@ -110,12 +110,40 @@ def run(duckrun_instance, pipeline: List[Tuple]) -> bool:
110
110
 
111
111
 
112
112
  def _run_python(duckrun_instance, name: str, args: tuple) -> Any:
113
- """Execute Python task, return result"""
113
+ """
114
+ Execute Python task, return result.
115
+
116
+ Automatically substitutes workspace/lakehouse names in args with their resolved IDs
117
+ to prevent URL encoding issues with names containing spaces.
118
+ """
114
119
  duckrun_instance._create_onelake_secret()
115
120
  func = _load_py_function(duckrun_instance, name)
116
121
  if not func:
117
122
  raise RuntimeError(f"Python function '{name}' not found")
118
123
 
124
+ # Get original and resolved names
125
+ original_workspace = duckrun_instance.workspace
126
+ original_lakehouse = duckrun_instance.lakehouse_name
127
+ resolved_workspace = duckrun_instance.workspace_id
128
+ resolved_lakehouse = duckrun_instance.lakehouse_id
129
+
130
+ # Substitute workspace/lakehouse names in args if they differ
131
+ # This prevents URL encoding issues when names contain spaces
132
+ substituted_args = []
133
+ needs_substitution = (original_workspace != resolved_workspace or
134
+ original_lakehouse != resolved_lakehouse)
135
+
136
+ if needs_substitution:
137
+ for arg in args:
138
+ if arg == original_workspace:
139
+ substituted_args.append(resolved_workspace)
140
+ elif arg == original_lakehouse:
141
+ substituted_args.append(resolved_lakehouse)
142
+ else:
143
+ substituted_args.append(arg)
144
+ args = tuple(substituted_args)
145
+ print(f"📝 Auto-substituted workspace/lakehouse names in args for URL compatibility")
146
+
119
147
  print(f"Running Python: {name}{args}")
120
148
  result = func(*args)
121
149
  print(f"✅ Python '{name}' completed")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: duckrun
3
- Version: 0.2.5.dev2
3
+ Version: 0.2.5.dev4
4
4
  Summary: Lakehouse task runner powered by DuckDB for Microsoft Fabric
5
5
  Author: mim
6
6
  License: MIT
@@ -0,0 +1,12 @@
1
+ duckrun/__init__.py,sha256=XA85pL2vK1AkmBic8e7WxeqNvcd6SjFX4zsQpImDO6E,230
2
+ duckrun/core.py,sha256=6Us3dRuQFCziK12r0j2CuwgcDQeV78iEeLcA40IwIiA,39476
3
+ duckrun/files.py,sha256=piWRU5w9jHrW-wuV4Gf-SKY_jhFv9eflxgWO8AZCQTI,10495
4
+ duckrun/lakehouse.py,sha256=j--Z3zo8AOWt1GF9VzRosmmTAy6ey2D0LVubti58twU,14109
5
+ duckrun/runner.py,sha256=XsQqWlesFD2cuhH2gsQj3Astg0XN7xhW15WPmr8D65I,13797
6
+ duckrun/stats.py,sha256=2FTqoQNVjD84-H1HjStHxZkOpAGKXS79M55B00pOlok,9804
7
+ duckrun/writer.py,sha256=eWrGtDQTbXi8H3sSt2WucYTdEQUjK97KmQxzCbqAuMs,6221
8
+ duckrun-0.2.5.dev4.dist-info/licenses/LICENSE,sha256=-DeQQwdbCbkB4507ZF3QbocysB-EIjDtaLexvqRkGZc,1083
9
+ duckrun-0.2.5.dev4.dist-info/METADATA,sha256=HE5rFI5A227bw-prSq3cHv9wR9-etSYJD31lIrKjpzs,18344
10
+ duckrun-0.2.5.dev4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
11
+ duckrun-0.2.5.dev4.dist-info/top_level.txt,sha256=BknMEwebbUHrVAp3SC92ps8MPhK7XSYsaogTvi_DmEU,8
12
+ duckrun-0.2.5.dev4.dist-info/RECORD,,
@@ -1,12 +0,0 @@
1
- duckrun/__init__.py,sha256=XA85pL2vK1AkmBic8e7WxeqNvcd6SjFX4zsQpImDO6E,230
2
- duckrun/core.py,sha256=UgBE90zTFvnieTrUEb4tDA2cWSwFfh24M_e46FTmFvg,38345
3
- duckrun/files.py,sha256=piWRU5w9jHrW-wuV4Gf-SKY_jhFv9eflxgWO8AZCQTI,10495
4
- duckrun/lakehouse.py,sha256=j--Z3zo8AOWt1GF9VzRosmmTAy6ey2D0LVubti58twU,14109
5
- duckrun/runner.py,sha256=lfwNoU1CZXh6bPTHvGWVaUWjzG5crvT7Pzq4onMEVjw,12576
6
- duckrun/stats.py,sha256=2FTqoQNVjD84-H1HjStHxZkOpAGKXS79M55B00pOlok,9804
7
- duckrun/writer.py,sha256=eWrGtDQTbXi8H3sSt2WucYTdEQUjK97KmQxzCbqAuMs,6221
8
- duckrun-0.2.5.dev2.dist-info/licenses/LICENSE,sha256=-DeQQwdbCbkB4507ZF3QbocysB-EIjDtaLexvqRkGZc,1083
9
- duckrun-0.2.5.dev2.dist-info/METADATA,sha256=wiB12-pG_jlyUbghVNMyE3KHcwt8GFJd04VNZ2C4VwE,18344
10
- duckrun-0.2.5.dev2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
11
- duckrun-0.2.5.dev2.dist-info/top_level.txt,sha256=BknMEwebbUHrVAp3SC92ps8MPhK7XSYsaogTvi_DmEU,8
12
- duckrun-0.2.5.dev2.dist-info/RECORD,,