Skip to content

Commit

Permalink
Fix bug when creating a sqlite database via Felis (#87)
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-rodriguez authored Dec 11, 2024
1 parent 06dc172 commit cc26b7c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion astrodbkit/astrodb.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,8 @@ def create_database(connection_string, drop_tables=False, felis_schema=None):

# Schema handling for various database types
if connection_string.startswith("sqlite"):
db_name = connection_string.split("/")[-1]
# Get the full path to the file as otherwise the DB is only created in the working directory
db_name = connection_string.replace("sqlite:///", "")
with engine.begin() as conn:
conn.execute(text(f"ATTACH '{db_name}' AS {schema_name}"))
elif connection_string.startswith("postgres"):
Expand Down

0 comments on commit cc26b7c

Please sign in to comment.