I'm facing a case where I have to manually insert data from old DB into a new one. The new one is a DB that'll be used by a Django application.
For that I have CSV file or whatever that I iterate over, and the thing is that I also use the id from this file, because I need to keep it.
For instance I do :
from django.db import connections
cursor = connections["default"].cursor()
cursor.execute("INSERT INTO my_table (id, name) VALUES (3, 'test')")
If I use such ID (3), the next time I'll want to insert data through my django application, it'll create a record with ID 1, then ID 2, then I'll have an error because it'll try to create data for ID 3.
How can I make it skip existing ID ?
Thanks in advance !