-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtruncateTable.py
37 lines (30 loc) · 1000 Bytes
/
truncateTable.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import database_connect
import aitestOrm
from sqlalchemy import text
session = database_connect.get_session('database_aitest')
def truncate_table(table):
session.execute(text(f"DELETE FROM {table.__tablename__}"))
session.commit()
print(f"Truncate table {table.__tablename__} successfully.")
def truncate_prompt():
truncate_table(aitestOrm.AnnotationGen)
truncate_table(aitestOrm.KnlgExp)
truncate_table(aitestOrm.CaseGen)
truncate_table(aitestOrm.CodeGen)
truncate_table(aitestOrm.CodeCor)
truncate_table(aitestOrm.PromptComp)
truncate_table(aitestOrm.ComplementGen)
truncate_table(aitestOrm.PromptEval)
truncate_table(aitestOrm.EvaluateGen)
def truncate_test_data():
truncate_table(aitestOrm.Code)
truncate_table(aitestOrm.ProblemForCode)
truncate_table(aitestOrm.Problem)
truncate_table(aitestOrm.KnowledgePoint)
truncate_table(aitestOrm.ModelScore)
def truncate_all():
truncate_prompt()
truncate_test_data()
if __name__ == '__main__':
truncate_all()
#truncate_prompt()