mirror of
https://github.com/PhoenixTwoFive/karaoqueue.git
synced 2025-05-18 18:41:48 +02:00
Ensure Index exists after Song import
This commit is contained in:
parent
c50f00c1d3
commit
c8b65e4433
@ -28,6 +28,11 @@ def import_songs(song_csv):
|
||||
with get_db_engine().connect() as conn:
|
||||
df.to_sql(song_table, conn, if_exists='replace',
|
||||
index=False)
|
||||
try:
|
||||
cur = conn.execute(text("ALTER TABLE songs ADD FULLTEXT(Title,Artist)"))
|
||||
conn.commit()
|
||||
except Exception:
|
||||
pass
|
||||
cur = conn.execute(text("SELECT Count(Id) FROM songs"))
|
||||
num_songs = cur.fetchone()[0] # type: ignore
|
||||
conn.commit()
|
||||
|
Loading…
x
Reference in New Issue
Block a user