Answer the question
In order to leave comments, you need to log in
How can I prevent duplicate records from being entered into the database?
The user's city is entered into the database when he writes his city. If he writes the city again, then the bot crashes, because. there is already a city in the database. How to solve this problem?
Mistake:
sqlite3.IntegrityError: UNIQUE constraint failed: user_city
Answer the question
In order to leave comments, you need to log in
Your entire column is made unique, so you can't add a subsequent entry with that city
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question