Skip to content

Commit 3b6fa76

Browse files
roxx30198ZzEeKkAa
authored andcommitted
Check postfix record before insert
1 parent 34cb051 commit 3b6fa76

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

dpbench/infrastructure/datamodel.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,5 +190,11 @@ def store_postfix(conn: Engine, postfix: Postfix):
190190
:return:
191191
"""
192192
with Session(conn) as session:
193-
session.add(postfix)
194-
session.commit()
193+
existing_postfix = (
194+
session.query(Postfix)
195+
.filter_by(run_id=postfix.run_id, postfix=postfix.postfix)
196+
.first()
197+
)
198+
if existing_postfix is None:
199+
session.add(postfix)
200+
session.commit()

0 commit comments

Comments
 (0)