Solved. I added a sleep at the end of my loop and it worked, I think it was 
getting stuck because the db was not able to keep up with the update from 
the app and so the session got interrupted.

Em sexta-feira, 28 de outubro de 2022 às 10:46:54 UTC-4, Otávio Augusto 
escreveu:

> Greetings, I'm doing a integration projection, so I need to consume data 
> from a RESTful API and then save that data inside a oracle db. My models 
> migrated and succesfully created the tables, I was able to get the data 
> from the API and parse trough it to filter the info I wanted and needed to 
> save normally, then I first used 'objects.update_or_create' to populate my 
> table, initially it seemed to work but after some time it got stuck and 
> stopped inserting data into the table, I tried to switch to simply 
> 'objects.create' but it didnt work. I dont seem to find the issue that is 
> holding the insertion in place and decided to seek for help.
>
> For illustration, this is how I builted the code block that is getting 
> stuck:
> for item in value_list['itens']:
>      print(item)
>      Item.objects.using('default').create(
>               nature=item['nature'],
>               date=item['date'],
>               doc_number=item['doc_number'],
>               name=item['name'],
>               description=item['description']
>     )
>
> I even added .save(force_insert=True) to try and brute force the insertion 
> on the table but no avail. Need help!
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d37b05ad-7ea7-44a4-bdb2-86742c7622b7n%40googlegroups.com.

Reply via email to