duckrun 0.1.6__py3-none-any.whl → 0.1.6.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.
- duckrun/core.py +35 -11
- {duckrun-0.1.6.dist-info → duckrun-0.1.6.1.dist-info}/METADATA +1 -1
- duckrun-0.1.6.1.dist-info/RECORD +7 -0
- duckrun-0.1.6.dist-info/RECORD +0 -7
- {duckrun-0.1.6.dist-info → duckrun-0.1.6.1.dist-info}/WHEEL +0 -0
- {duckrun-0.1.6.dist-info → duckrun-0.1.6.1.dist-info}/licenses/LICENSE +0 -0
- {duckrun-0.1.6.dist-info → duckrun-0.1.6.1.dist-info}/top_level.txt +0 -0
duckrun/core.py
CHANGED
@@ -127,24 +127,47 @@ class Duckrun:
|
|
127
127
|
self._attach_lakehouse()
|
128
128
|
|
129
129
|
@classmethod
|
130
|
-
def connect(cls, workspace: Union[str, None] = None, lakehouse_name: Optional[str] = None,
|
131
|
-
schema: str = "dbo", sql_folder: Optional[str] = None,
|
130
|
+
def connect(cls, workspace: Union[str, None] = None, lakehouse_name: Optional[str] = None,
|
131
|
+
schema: str = "dbo", sql_folder: Optional[str] = None,
|
132
132
|
compaction_threshold: int = 100):
|
133
133
|
"""
|
134
134
|
Create and connect to lakehouse.
|
135
135
|
|
136
136
|
Supports two formats:
|
137
|
-
1. Compact: connect("ws/lh.lakehouse/schema") or connect("ws/lh.lakehouse")
|
138
|
-
2. Traditional: connect("ws", "lh", "schema") or connect("ws", "lh")
|
137
|
+
1. Compact: connect("ws/lh.lakehouse/schema", sql_folder=...) or connect("ws/lh.lakehouse")
|
138
|
+
2. Traditional: connect("ws", "lh", "schema", sql_folder) or connect("ws", "lh")
|
139
139
|
|
140
|
-
|
141
|
-
|
140
|
+
Args:
|
141
|
+
workspace: Workspace name or full path "ws/lh.lakehouse/schema"
|
142
|
+
lakehouse_name: Lakehouse name (optional if using compact format)
|
143
|
+
schema: Schema name (defaults to "dbo")
|
144
|
+
sql_folder: Optional path or URL to SQL files folder
|
145
|
+
compaction_threshold: File count threshold for compaction
|
146
|
+
|
147
|
+
Examples:
|
148
|
+
# Compact format (second param treated as sql_folder if it's a URL/path string)
|
149
|
+
dr = Duckrun.connect("temp/power.lakehouse/wa", "https://github.com/.../sql/")
|
150
|
+
dr = Duckrun.connect("ws/lh.lakehouse/schema", "./sql")
|
151
|
+
dr = Duckrun.connect("ws/lh.lakehouse/schema") # no SQL folder
|
152
|
+
|
153
|
+
# Traditional format
|
154
|
+
dr = Duckrun.connect("ws", "lh", "schema", "./sql")
|
155
|
+
dr = Duckrun.connect("ws", "lh", "schema")
|
142
156
|
"""
|
143
157
|
print("Connecting to Lakehouse...")
|
144
158
|
|
145
159
|
scan_all_schemas = False
|
146
160
|
|
147
|
-
if
|
161
|
+
# Check if using compact format: "ws/lh.lakehouse/schema" or "ws/lh.lakehouse"
|
162
|
+
# If second param looks like a path/URL and not a lakehouse name, treat it as sql_folder
|
163
|
+
if workspace and "/" in workspace and (lakehouse_name is None or
|
164
|
+
(isinstance(lakehouse_name, str) and ('/' in lakehouse_name or lakehouse_name.startswith('http') or lakehouse_name.startswith('.')))):
|
165
|
+
|
166
|
+
# If lakehouse_name looks like a sql_folder, shift it
|
167
|
+
if lakehouse_name and ('/' in lakehouse_name or lakehouse_name.startswith('http') or lakehouse_name.startswith('.')):
|
168
|
+
sql_folder = lakehouse_name
|
169
|
+
lakehouse_name = None
|
170
|
+
|
148
171
|
parts = workspace.split("/")
|
149
172
|
if len(parts) == 2:
|
150
173
|
workspace, lakehouse_name = parts
|
@@ -162,6 +185,7 @@ class Duckrun:
|
|
162
185
|
if lakehouse_name.endswith(".lakehouse"):
|
163
186
|
lakehouse_name = lakehouse_name[:-10]
|
164
187
|
elif lakehouse_name is not None:
|
188
|
+
# Traditional format - check if schema was explicitly provided
|
165
189
|
if schema == "dbo":
|
166
190
|
scan_all_schemas = True
|
167
191
|
print(f"ℹ️ No schema specified. Using default schema 'dbo' for operations.")
|
@@ -170,10 +194,10 @@ class Duckrun:
|
|
170
194
|
if not workspace or not lakehouse_name:
|
171
195
|
raise ValueError(
|
172
196
|
"Missing required parameters. Use either:\n"
|
173
|
-
" connect('workspace/lakehouse.lakehouse/schema')\n"
|
174
|
-
" connect('workspace/lakehouse.lakehouse') # defaults to dbo
|
175
|
-
" connect('workspace', 'lakehouse', 'schema')\n"
|
176
|
-
" connect('workspace', 'lakehouse') # defaults to dbo
|
197
|
+
" connect('workspace/lakehouse.lakehouse/schema', 'sql_folder')\n"
|
198
|
+
" connect('workspace/lakehouse.lakehouse') # defaults to dbo\n"
|
199
|
+
" connect('workspace', 'lakehouse', 'schema', 'sql_folder')\n"
|
200
|
+
" connect('workspace', 'lakehouse') # defaults to dbo"
|
177
201
|
)
|
178
202
|
|
179
203
|
return cls(workspace, lakehouse_name, schema, sql_folder, compaction_threshold, scan_all_schemas)
|
@@ -0,0 +1,7 @@
|
|
1
|
+
duckrun/__init__.py,sha256=L0jRtD9Ld8Ti4e6GRvPDdHvkQCFAPHM43GSP7ARh6EM,241
|
2
|
+
duckrun/core.py,sha256=A5UdhpdEE9Wzje5d16c0ejTWn24zy5LCaoX6OghO8Us,23352
|
3
|
+
duckrun-0.1.6.1.dist-info/licenses/LICENSE,sha256=-DeQQwdbCbkB4507ZF3QbocysB-EIjDtaLexvqRkGZc,1083
|
4
|
+
duckrun-0.1.6.1.dist-info/METADATA,sha256=oHc38InTVr48Hp2mER4tbFL0RkWMEFXqg48OPYTk9qk,9358
|
5
|
+
duckrun-0.1.6.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
6
|
+
duckrun-0.1.6.1.dist-info/top_level.txt,sha256=BknMEwebbUHrVAp3SC92ps8MPhK7XSYsaogTvi_DmEU,8
|
7
|
+
duckrun-0.1.6.1.dist-info/RECORD,,
|
duckrun-0.1.6.dist-info/RECORD
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
duckrun/__init__.py,sha256=L0jRtD9Ld8Ti4e6GRvPDdHvkQCFAPHM43GSP7ARh6EM,241
|
2
|
-
duckrun/core.py,sha256=H7Q-mvE5ET3mdEi7VTubWdaCrgVaJW9G0LfAu0Gpw-g,21872
|
3
|
-
duckrun-0.1.6.dist-info/licenses/LICENSE,sha256=-DeQQwdbCbkB4507ZF3QbocysB-EIjDtaLexvqRkGZc,1083
|
4
|
-
duckrun-0.1.6.dist-info/METADATA,sha256=20vTn4-9fn8iqwXGjYT3IQd9Xk47sQAD-Tv3wk2Pp9I,9356
|
5
|
-
duckrun-0.1.6.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
6
|
-
duckrun-0.1.6.dist-info/top_level.txt,sha256=BknMEwebbUHrVAp3SC92ps8MPhK7XSYsaogTvi_DmEU,8
|
7
|
-
duckrun-0.1.6.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|