duckrun 0.1.2__tar.gz → 0.1.3__tar.gz
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-0.1.2 → duckrun-0.1.3}/PKG-INFO +1 -1
- {duckrun-0.1.2 → duckrun-0.1.3}/duckrun/core.py +31 -31
- {duckrun-0.1.2 → duckrun-0.1.3}/duckrun.egg-info/PKG-INFO +1 -1
- {duckrun-0.1.2 → duckrun-0.1.3}/pyproject.toml +1 -1
- {duckrun-0.1.2 → duckrun-0.1.3}/LICENSE +0 -0
- {duckrun-0.1.2 → duckrun-0.1.3}/README.md +0 -0
- {duckrun-0.1.2 → duckrun-0.1.3}/duckrun/__init__.py +0 -0
- {duckrun-0.1.2 → duckrun-0.1.3}/duckrun.egg-info/SOURCES.txt +0 -0
- {duckrun-0.1.2 → duckrun-0.1.3}/duckrun.egg-info/dependency_links.txt +0 -0
- {duckrun-0.1.2 → duckrun-0.1.3}/duckrun.egg-info/requires.txt +0 -0
- {duckrun-0.1.2 → duckrun-0.1.3}/duckrun.egg-info/top_level.txt +0 -0
- {duckrun-0.1.2 → duckrun-0.1.3}/setup.cfg +0 -0
@@ -64,44 +64,44 @@ class Duckrun:
|
|
64
64
|
def _attach_lakehouse(self):
|
65
65
|
self._create_onelake_secret()
|
66
66
|
try:
|
67
|
-
#
|
67
|
+
# Use expensive list operation but filter for _delta_log folders only
|
68
|
+
# This avoids parsing JSON content that causes Iceberg metadata issues
|
69
|
+
print(f"Scanning for Delta tables in {self.schema}... (this may take a moment)")
|
70
|
+
|
68
71
|
list_tables_query = f"""
|
69
|
-
SELECT DISTINCT
|
70
|
-
|
71
|
-
|
72
|
+
SELECT DISTINCT
|
73
|
+
regexp_extract(file, 'Tables/{self.schema}/([^/]+)/_delta_log', 1) as table_name
|
74
|
+
FROM glob("abfss://{self.workspace}@onelake.dfs.fabric.microsoft.com/{self.lakehouse_name}.Lakehouse/Tables/{self.schema}/**")
|
75
|
+
WHERE file LIKE '%/_delta_log/%'
|
76
|
+
AND file NOT LIKE '%/metadata/%'
|
72
77
|
AND file NOT LIKE '%/iceberg/%'
|
73
|
-
AND
|
74
|
-
AND split_part(file, '_delta_log', 1) NOT LIKE '%/iceberg'
|
78
|
+
AND regexp_extract(file, 'Tables/{self.schema}/([^/]+)/_delta_log', 1) IS NOT NULL
|
75
79
|
"""
|
80
|
+
|
76
81
|
list_tables_df = self.con.sql(list_tables_query).df()
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
print(f"No Delta tables found in {self.lakehouse_name}.Lakehouse/Tables.")
|
82
|
+
|
83
|
+
if list_tables_df.empty:
|
84
|
+
print(f"No Delta tables found in {self.lakehouse_name}.Lakehouse/Tables/{self.schema}.")
|
81
85
|
return
|
86
|
+
|
87
|
+
table_names = list_tables_df['table_name'].tolist()
|
82
88
|
|
83
|
-
print(f"Found {len(
|
89
|
+
print(f"Found {len(table_names)} Delta tables. Attaching as views...")
|
84
90
|
|
85
|
-
for
|
86
|
-
|
87
|
-
if
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
AS SELECT * FROM delta_scan('{self.table_base_url}{self.schema}/{table}');
|
100
|
-
""")
|
101
|
-
print(f" ✓ Attached: {table}")
|
102
|
-
except Exception as e:
|
103
|
-
print(f" ⚠ Skipped {table}: {str(e)[:100]}")
|
104
|
-
continue
|
91
|
+
for table in table_names:
|
92
|
+
# Skip Iceberg-related folders and empty names
|
93
|
+
if not table or table in ('metadata', 'iceberg'):
|
94
|
+
continue
|
95
|
+
|
96
|
+
try:
|
97
|
+
self.con.sql(f"""
|
98
|
+
CREATE OR REPLACE VIEW {table}
|
99
|
+
AS SELECT * FROM delta_scan('{self.table_base_url}{self.schema}/{table}');
|
100
|
+
""")
|
101
|
+
print(f" ✓ Attached: {table}")
|
102
|
+
except Exception as e:
|
103
|
+
print(f" ⚠ Skipped {table}: {str(e)[:100]}")
|
104
|
+
continue
|
105
105
|
|
106
106
|
print("\nAttached tables (views) in DuckDB:")
|
107
107
|
self.con.sql("SELECT name FROM (SHOW ALL TABLES) WHERE database='memory'").show()
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|