Skip to content

Commit 564db4f

Browse files
committed
load csv: use transaction in .delete() SQLAlchemy
Signed-off-by: Avelino <31996+avelino@users.noreply.github.com>
1 parent 96f71e3 commit 564db4f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

‎src/load_csv.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ def load_csv_and_generate_embeddings(path, cleardb=False):
2828
)
2929

3030
if cleardb:
31-
CompanyContent.query.delete()
31+
session.query(CompanyContent).delete()
32+
session.commit()
3233

3334
df_in_db = pd.read_sql(
3435
text(

0 commit comments

Comments
 (0)