Interesting, is there a way to peek for an existing record instead of
calling get to see whether the record exists in the database? I'm thinking
of making this snippet of code a bit more efficient
try:
obj = Hackathon.objects.get(**each_dict)
except Hackathon.DoesNotExist:
obj = Hackathon
Take a look at update_or_create()
https://docs.djangoproject.com/en/3.2/ref/models/querysets/#update-or-create
On Sat, Sep 18, 2021, 9:27 AM Adib Neymar Jr. wrote:
> Hello,
>
> What is a good way to compare new data with old data which is updated
> everyday with Django ORM? Basically I have a s
Hello,
What is a good way to compare new data with old data which is updated
everyday with Django ORM? Basically I have a scraper which fetches
hackathons everyday (basically just a celery task) and I want the newest to
be unioned it with my master database which has the latest fetched
hackathons
3 matches
Mail list logo