We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b2b442c commit ac00fdaCopy full SHA for ac00fda
1 file changed
pythonicMySQL/constructor/table.py
@@ -37,7 +37,7 @@ def to_mysql_dict(self, obj, remove_id: bool = False) -> dict:
37
def insert(self, obj: T, update_if_exists=False, commit: bool = True):
38
if update_if_exists and len([column for column in columns(obj) if column.unique]) == 0:
39
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),
+ return CLIENT.insert(self.database, self.table, self.to_mysql_dict(obj, remove_id=True),
41
update_if_duplicate_key=update_if_exists, commit=commit)
42
43
def update(self, mysql_id: int, obj: T, commit=True):
0 commit comments