Here is my code for updating postgresql DB table via sqlalchemy orm:
db_car_record = session.query(CarsTable).update({CarsTable.CarId : 37805,
CarsTable.AuctionId : 879})
session.commit()
I receive the duplicate key error. Do you have any idea?
sqlalchemy.exc.IntegrityError: (psycopg2.IntegrityError) duplicate key value violates unique constraint "ix_carstable_CarId"
DETAIL: Key ("CarId")=(37805) already exists.
[SQL: 'UPDATE carstable SET "AuctionId"=%(AuctionId)s, "CarId"=%(CarId)s,
updated_on=%(updated_on)s'] [parameters: {'updated_on': datetime.datetime(2017, 8, 12, 3, 49, 23, 115733), 'CarId': 37805, 'AuctionId': 879}]
CarId37805. I'm not sure how to make that any clearer.