Re: How to update old data with new data everyday from a scraper

2021-09-19 Thread Adib Neymar Jr.
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

Re: How to update old data with new data everyday from a scraper

2021-09-18 Thread Jason Turner
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

How to update old data with new data everyday from a scraper

2021-09-18 Thread Adib Neymar Jr.
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