Hello, I'm Jango and DB Wang novice. I'm writing to ask you a long db question.
I wrote a script to store the contents of a site information obtained through real-time crawling in Django db.
What I'm curious about is that if I run this script again, is there a way to save only the modified or added parts in the db without saving the duplicate values?
django database
What you probably want is to call UpdateOrCreate.
obj, created = Person.objects.update_or_create(
first_name='John', last_name='Lennon',
defaults={'first_name': 'Bob'},
)
© 2024 OneMinuteCode. All rights reserved.