Skip to content

Commit a93385f

Browse files
committed
Added truncate
1 parent 0f0d613 commit a93385f

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/server/api/API_ingest/shelterluv_db.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,22 @@ def insert_animals(animal_list):
4646
session.close()
4747

4848
return ret.rowcount
49+
50+
51+
def truncate_animals():
52+
"""Truncate the shelterluv_animals table"""
53+
54+
55+
Session = sessionmaker(engine)
56+
session = Session()
57+
metadata = MetaData()
58+
sla = Table("shelterluv_animals", metadata, autoload=True, autoload_with=engine)
59+
60+
61+
truncate = "TRUNCATE table shelterluv_animals;"
62+
result = session.execute(truncate)
63+
64+
session.commit() # Commit all inserted rows
65+
session.close()
66+
67+
return 0

0 commit comments

Comments
 (0)