duckrun 0.2.14.dev1__py3-none-any.whl → 0.2.14.dev2__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 duckrun might be problematic. Click here for more details.

duckrun/__init__.py CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  from duckrun.core import Duckrun
4
4
 
5
- __version__ = "0.2.14.dev1"
5
+ __version__ = "0.2.14.dev2"
6
6
 
7
7
  # Expose unified connect method at module level
8
8
  connect = Duckrun.connect
duckrun/core.py CHANGED
@@ -587,24 +587,97 @@ class Duckrun:
587
587
  except Exception as e:
588
588
  print(f"⚠️ Warning: Could not register lookup functions: {e}")
589
589
 
590
- def get_workspace_id(self) -> str:
590
+ def get_workspace_id(self, force: bool = False) -> str:
591
591
  """
592
592
  Get the workspace ID (GUID or name without spaces).
593
593
  Use this when passing workspace parameter to Python functions.
594
594
 
595
+ Args:
596
+ force: If True, always resolve to actual GUID via API. If False, returns stored value (default: False)
597
+
595
598
  Returns:
596
599
  Workspace ID - either a GUID or workspace name without spaces
597
600
  """
601
+ if not force:
602
+ return self.workspace_id
603
+
604
+ # Force resolution to GUID
605
+ import re
606
+ guid_pattern = re.compile(r'^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$', re.IGNORECASE)
607
+
608
+ # If already a GUID, return it
609
+ if guid_pattern.match(self.workspace_id):
610
+ return self.workspace_id
611
+
612
+ # Try to get from notebook context first (fastest)
613
+ try:
614
+ import notebookutils # type: ignore
615
+ workspace_guid = notebookutils.runtime.context.get("workspaceId")
616
+ if workspace_guid:
617
+ return workspace_guid
618
+ except ImportError:
619
+ pass
620
+
621
+ # Resolve via API
622
+ try:
623
+ from .auth import get_fabric_api_token
624
+ token = get_fabric_api_token()
625
+ if token:
626
+ resolved_id = self._resolve_workspace_id_by_name(token, self.workspace_id)
627
+ if resolved_id:
628
+ return resolved_id
629
+ except Exception:
630
+ pass
631
+
632
+ # Fallback to original value
598
633
  return self.workspace_id
599
634
 
600
- def get_lakehouse_id(self) -> str:
635
+ def get_lakehouse_id(self, force: bool = False) -> str:
601
636
  """
602
637
  Get the lakehouse ID (GUID or name).
603
638
  Use this when passing lakehouse parameter to Python functions.
604
639
 
640
+ Args:
641
+ force: If True, always resolve to actual GUID via API. If False, returns stored value (default: False)
642
+
605
643
  Returns:
606
644
  Lakehouse ID - either a GUID or lakehouse name
607
645
  """
646
+ if not force:
647
+ return self.lakehouse_id
648
+
649
+ # Force resolution to GUID
650
+ import re
651
+ guid_pattern = re.compile(r'^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$', re.IGNORECASE)
652
+
653
+ # If already a GUID, return it
654
+ if guid_pattern.match(self.lakehouse_id):
655
+ return self.lakehouse_id
656
+
657
+ # Try to get from notebook context first (fastest)
658
+ try:
659
+ import notebookutils # type: ignore
660
+ lakehouse_guid = notebookutils.lakehouse.get("id")
661
+ if lakehouse_guid:
662
+ return lakehouse_guid
663
+ except (ImportError, Exception):
664
+ pass
665
+
666
+ # Resolve via API
667
+ try:
668
+ from .auth import get_fabric_api_token
669
+ token = get_fabric_api_token()
670
+ if token:
671
+ # First get workspace GUID
672
+ workspace_guid = self.get_workspace_id(force=True)
673
+ # Then resolve lakehouse name to ID
674
+ resolved_id = self._resolve_lakehouse_id_by_name(token, workspace_guid, self.lakehouse_id)
675
+ if resolved_id:
676
+ return resolved_id
677
+ except Exception:
678
+ pass
679
+
680
+ # Fallback to original value
608
681
  return self.lakehouse_id
609
682
 
610
683
  def run(self, pipeline: List[Tuple]) -> bool:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: duckrun
3
- Version: 0.2.14.dev1
3
+ Version: 0.2.14.dev2
4
4
  Summary: Lakehouse task runner powered by DuckDB for Microsoft Fabric
5
5
  Author: mim
6
6
  License: MIT
@@ -1,14 +1,14 @@
1
- duckrun/__init__.py,sha256=OxPnNrxYqv_2XfiQPO27JiZDIxze4jnUE3VaqDdioAg,236
1
+ duckrun/__init__.py,sha256=oPQXpJEgHpX_KgMrx_TWax9awIbr2B9z32cFuuG_p30,236
2
2
  duckrun/auth.py,sha256=dMqIzozgEQ5v7Uc3Mb_OoFZGmsAq0m-VOoYCVL7rehc,9281
3
- duckrun/core.py,sha256=LvxplwziTLb_18n064waoN3oWMuhpVJe_-y6GYfoBOc,53127
3
+ duckrun/core.py,sha256=Rbfm0VtN3o-tMg1_iH5yCtgBFOAXbp6GeExgtxg4MX0,55912
4
4
  duckrun/files.py,sha256=Fvdjg3DyHJzIVzKo8M_j-eGz4zU61lOB38Y_onbQJkI,10137
5
5
  duckrun/lakehouse.py,sha256=j--Z3zo8AOWt1GF9VzRosmmTAy6ey2D0LVubti58twU,14109
6
6
  duckrun/runner.py,sha256=yrDxfy1RVkb8iK9GKGmIFZHzCvcO_0GVQlbng7Vw_iM,14171
7
7
  duckrun/semantic_model.py,sha256=obzlN2-dbEW3JmDop-vrZGGGLi9u3ThhTbgtDjou7uY,29509
8
8
  duckrun/stats.py,sha256=oKIjZ7u5cFVT63FuOl5UqoDsOG3098woSCn-uI6i_sQ,11084
9
9
  duckrun/writer.py,sha256=svUuPCYOhrz299NgnpTKhARKjfej0PxnoND2iPDSypk,8098
10
- duckrun-0.2.14.dev1.dist-info/licenses/LICENSE,sha256=-DeQQwdbCbkB4507ZF3QbocysB-EIjDtaLexvqRkGZc,1083
11
- duckrun-0.2.14.dev1.dist-info/METADATA,sha256=MhpAtTMLpzOwOINN7Dgs6ih_JhjhbzxX73W_E6N30pA,20771
12
- duckrun-0.2.14.dev1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
13
- duckrun-0.2.14.dev1.dist-info/top_level.txt,sha256=BknMEwebbUHrVAp3SC92ps8MPhK7XSYsaogTvi_DmEU,8
14
- duckrun-0.2.14.dev1.dist-info/RECORD,,
10
+ duckrun-0.2.14.dev2.dist-info/licenses/LICENSE,sha256=-DeQQwdbCbkB4507ZF3QbocysB-EIjDtaLexvqRkGZc,1083
11
+ duckrun-0.2.14.dev2.dist-info/METADATA,sha256=94ZCUDXEIK9BQRYhBoc1H1n_bZx5giXEulpazkK9FU4,20771
12
+ duckrun-0.2.14.dev2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
13
+ duckrun-0.2.14.dev2.dist-info/top_level.txt,sha256=BknMEwebbUHrVAp3SC92ps8MPhK7XSYsaogTvi_DmEU,8
14
+ duckrun-0.2.14.dev2.dist-info/RECORD,,