mirror of
https://github.com/ada-dmitry/lab6.git
synced 2026-09-24 09:20:15 +00:00
fix(unique)_func_insert
This commit is contained in:
+5
-2
@@ -64,8 +64,11 @@ class DbTable:
|
||||
sql += ", ".join(self.column_names_without_id()) + ") VALUES("
|
||||
sql += ", ".join(vals) + ")"
|
||||
cur = self.dbconn.conn.cursor()
|
||||
cur.execute(sql)
|
||||
self.dbconn.conn.commit()
|
||||
try:
|
||||
cur.execute(sql)
|
||||
self.dbconn.conn.commit()
|
||||
except psycopg2.errors.UniqueViolation:
|
||||
self.dbconn.conn.rollback()
|
||||
return
|
||||
|
||||
def first(self):
|
||||
|
||||
Reference in New Issue
Block a user