Skip to content

Commit cc26b7c

Browse files
authored
Fix bug when creating a sqlite database via Felis (#87)
1 parent 06dc172 commit cc26b7c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

astrodbkit/astrodb.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,8 @@ def create_database(connection_string, drop_tables=False, felis_schema=None):
223223

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

0 commit comments

Comments
 (0)