my project doesnt insert into the database

51 views
Skip to first unread message

Otávio Augusto

unread,
Oct 28, 2022, 10:46:54 AM10/28/22
to Django users
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!

Ryan Nowakowski

unread,
Oct 29, 2022, 8:38:04 AM10/29/22
to django...@googlegroups.com
When it gets stuck, does it crash and return a traceback or just hang?

Lakshyaraj Dash

unread,
Oct 29, 2022, 8:42:32 AM10/29/22
to django...@googlegroups.com
Replace value_list['itens'] by value_list['items']. May be there some typo error 

--
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...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAE0EE0F-E2BB-4CF3-9678-0F39596BDC8A%40fattuba.com.

Otávio Augusto

unread,
Oct 31, 2022, 8:08:38 AM10/31/22
to Django users
it just hang, doesnt crash nor raise any errors or exceptions, I even tried to cover it up in a try block but it did not return an error.

Otávio Augusto

unread,
Oct 31, 2022, 8:09:25 AM10/31/22
to Django users
I'll try but I dont think its a typo, cause I printed the value of 'itens' and it worked fine

Otávio Augusto

unread,
Nov 1, 2022, 8:47:36 AM11/1/22
to Django users
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.

Mh Raffi

unread,
Nov 1, 2022, 9:41:40 AM11/1/22
to django...@googlegroups.com
Hi Sorry Looking for thread to my problem. Landed here.
Am new to django and python.

I need to deploy my app live. i have got a domain name in hostiger.
How to deploy in rail with connecting to hostinger. 
Hope i will find the solution here

Thanks & Regards
Mohammed Raffi.J


--
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...@googlegroups.com.

Kasper Laudrup

unread,
Nov 2, 2022, 9:59:56 AM11/2/22
to django...@googlegroups.com
On 01/11/2022 14.09, Mh Raffi wrote:
> Hi Sorry Looking for thread to my problem. Landed here.

That is not how a mailing list or forum works. You don't find an
existing thread and use it for a completely unrelated issue.

You simply post a new message/mail with your issue instead. Maybe
reading this would be a good start:

https://support.google.com/groups/

Kind regards,

Kasper Laudrup

subin

unread,
Nov 3, 2022, 3:44:28 PM11/3/22
to django...@googlegroups.com
Hi

--
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...@googlegroups.com.

subin

unread,
Nov 3, 2022, 4:15:08 PM11/3/22
to django...@googlegroups.com
Thanks for leaving a voicemail! We appreciate your patience and will get back to you by the end of the day.

subin

unread,
Nov 3, 2022, 4:15:54 PM11/3/22
to django...@googlegroups.com
Our team is out spending time with loved ones. We’ll be back on November 29 to respond to your text. Have a great Thanksgiving weekend!

--

subin

unread,
Nov 3, 2022, 4:55:31 PM11/3/22
to django...@googlegroups.com
Sorry to write again so quickly.

subin

unread,
Nov 3, 2022, 4:56:11 PM11/3/22
to django...@googlegroups.com
Please let me know if that is acceptable with you.

--
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...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages