Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions biasanalyzer/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ def _initialize(self, db_url, omop_db_url=None):
ATTACH '{self.omop_cdm_db_url}' as {self.omop_alias} (TYPE postgres)
""")
elif omop_db_url.endswith(".duckdb"):
try:
self.conn.execute(f"DETACH DATABASE {self.omop_alias}")
except (duckdb.BinderException, duckdb.CatalogException):
# ignore if not attached yet
pass
self.conn.execute(f"""
ATTACH '{self.omop_cdm_db_url}' as {self.omop_alias}
""")
Expand Down