We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4474812 commit 1966761Copy full SHA for 1966761
requirements.txt
@@ -1,2 +1,3 @@
1
http_request_recorder @ git+https://github.com/sipgate/http-request-recorder.git@main
2
+SQLAlchemy~=2.0.43
3
pre-commit
sipgate_e2e_test_utils/db.py
@@ -0,0 +1,14 @@
+from sqlalchemy import text
+from sqlalchemy.engine import Engine
+from sqlalchemy.orm import Session
4
+
5
6
+def clear_all_tables(db_engine: Engine, model):
7
+ with Session(db_engine) as db_session:
8
+ tables = list(model.metadata.sorted_tables)
9
+ tables.reverse()
10
+ db_session.execute(text('SET FOREIGN_KEY_CHECKS = 0;'))
11
+ for table in tables:
12
+ db_session.execute(table.delete())
13
+ db_session.execute(text('SET FOREIGN_KEY_CHECKS = 1;'))
14
+ db_session.commit()
0 commit comments