Saturday, October 29, 2022

Re: my project doesnt insert into the database

When it gets stuck, does it crash and return a traceback or just hang?

On October 28, 2022 9:16:41 AM CDT, "Otávio Augusto" <taviinhuzys@gmail.com> wrote:
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!

No comments:

Post a Comment