Skip to content

Commit ac00fda

Browse files
committed
fix bug that creates duplicate id
1 parent b2b442c commit ac00fda

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

pythonicMySQL/constructor/table.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def to_mysql_dict(self, obj, remove_id: bool = False) -> dict:
3737
def insert(self, obj: T, update_if_exists=False, commit: bool = True):
3838
if update_if_exists and len([column for column in columns(obj) if column.unique]) == 0:
3939
raise AssertionError("You cannot use update_if_exists when there are no unique keys")
40-
return CLIENT.insert(self.database, self.table, self.to_mysql_dict(obj),
40+
return CLIENT.insert(self.database, self.table, self.to_mysql_dict(obj, remove_id=True),
4141
update_if_duplicate_key=update_if_exists, commit=commit)
4242

4343
def update(self, mysql_id: int, obj: T, commit=True):

0 commit comments

Comments
 (0)