Skip to content

Commit

Permalink
Update duckdb.py
Browse files Browse the repository at this point in the history
  • Loading branch information
buremba committed Oct 20, 2024
1 parent 392eff8 commit 890ad48
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion universql/warehouse/duckdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,9 +268,14 @@ def __init__(self, context: dict, query_id: str, credentials: dict, compute: dic
if context.get('max_cache_size') != "0":
duck_config['max_temp_directory_size'] = context.get('max_cache_size')
self.account = parse_snowflake_account(context.get('account'))
database_path = self.context.get('database_path')
if database_path is not None:
database = os.path.join(database_path, "main.duckdb")
else:
database = ':memory:'

try:
self.duckdb = duckdb.connect(":memory:", config=duck_config)
self.duckdb = duckdb.connect(database, config=duck_config)
except duckdb.InvalidInputException as e:
raise QueryError(f"Unable to spin up DuckDB with config {duck_config}: {e}")
DuckDBFunctions.register(self.duckdb)
Expand Down

0 comments on commit 890ad48

Please sign in to comment.