Skip to content

Commit 383fa01

Browse files
committed
add exception for the iceberg table inserts
1 parent 307d2db commit 383fa01

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

tests/integration/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ def universql_connection(**properties) -> SnowflakeConnection:
112112
print(f"Reusing existing server running on port {server_cache[account]} for account {account}")
113113
else:
114114
from universql.main import snowflake
115-
with socketserver.TCPServer(("localhost", 0), None) as s:
115+
with socketserver.TCPServer(("127.0.0.1", 0), None) as s:
116116
free_port = s.server_address[1]
117117

118118
def start_universql():

universql/warehouse/duckdb.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,11 @@ def execute(self, ast: sqlglot.exp.Expression, catalog_executor: Executor, locat
351351
return {destination_table: ast.expression}
352352
elif isinstance(ast, Insert):
353353
table_type = self.catalog._get_table_location(destination_table)
354+
# if table_type is None:
355+
# tt = catalog_executor.catalog.get_table_paths([destination_table])
356+
# table_type = tt[destination_table]
357+
if table_type is None:
358+
raise QueryError(f"Duckdb can only INSERT INTO tables that is created within the session. {destination_table} is not created in this session")
354359
if table_type == TableType.ICEBERG:
355360
query = self._sync_and_transform_query(ast.expression, locations)
356361
namespace = self.catalog.iceberg_catalog.properties.get('namespace')

0 commit comments

Comments
 (0)