I have a User
Model
.
class User(db.Model):
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(80), unique=True)
I created this table in the database and I had some users which I exported from old database and loaded this in this new table via insert query. but now when I try to create user using ORM like below
user = User(name="sanjay")
db.session.add(user)
db.session.commit()
it's throwing below error.
DETAIL: Key (id)=(1) already exists
because a user with id 1 is already present in the table, so sqlalchemy should try to create a new record with latest id.
can someone help here?