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 12, 2024
1 parent d971974 commit 508b4c9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions universql/warehouse/duckdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ def __init__(self, context: dict, query_id: str, credentials: dict, compute: dic
'temp_directory': os.path.join(context.get('cache_directory'), "duckdb-staging"),
'max_temp_directory_size': context.get('max_cache_size'),
}
if os.access(context.get('home_directory'), os.W_OK):
if os.access(context.get('home_directory'), os.W_OK | os.X_OK):
duck_config["home_directory"] = context.get('home_directory')
else:
duck_config["access_mode"] = 'READ_ONLY'

try:
self.duckdb = duckdb.connect(duckdb_path, read_only=duck_config["access_mode"] == 'READ_ONLY',
self.duckdb = duckdb.connect(duckdb_path, read_only=duck_config.get("access_mode") == 'READ_ONLY' and duckdb_path != ':memory:',
config=duck_config)
except duckdb.InvalidInputException as e:
raise QueryError(f"Unable to spin up DuckDB ({duckdb_path}) with config {duck_config}: {e}")
Expand Down

0 comments on commit 508b4c9

Please sign in to comment.