Re: How to push data fetched from excel to DB using Django?

2020-05-11 Thread DAVID ALEJANDRO Pineda
You can use the Fixtures feature

First, pass to csv your spreadsheet

Then, you have in mind the model or set of models

ModelA
ModelB

The fields, the data type for every field.

Then, convert to a file of JSON to load with the fixture command.

I can share with you my code that do that:
https://gitlab.com/pineiden/csv-2-json


Other path is loading the django settings and reading every row and convert
to a dict and init the object
Like this.
https://gitlab.com/pineiden/websocketsoftware/-/blob/master/websocketdatamanager/DjangoDataManager.py

Any question, write to me ;)






El vie., 8 may. 2020 a las 8:04, ratnadeep ray ()
escribió:

> Hi all,
>
> Can anyone let me know how to push the fetched data from an excel to any
> DB using Django?
>
> --
> 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/1e970207-0c86-4925-b4c8-dbce7c7c069d%40googlegroups.com
> 
> .
>


-- 
Ingeniero Civil Electricista U. de Chile
F: +56 9 82142267 - dpin...@ug.uchile.cl

-- 
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/CAM2MghgmJ%3Drdp%2B-UqHidr5mcNwEXVea4oG3xQEH0_x3VS9CvjQ%40mail.gmail.com.


Re: How to push data fetched from excel to DB using Django?

2020-05-08 Thread Motaz Hejaze
first , check your excel file , see what are the columns types ..
then , make a model in django models.py and choose model fields to be the
same type as each column in the excel file ..
in your views.py make a function that will read the excel file from the
file location on your machine ..
in this function use the code provided in Kasper tutorial link
https://www.geeksforgeeks.org/reading-excel-file-using-python/
while you are looping through each row in your excel file you can populate
the model you created in models.py ..
but if the excel file is too large , this will block your code , maybe
cause the database to be locked too ..
if you face this problem consider using threading or asyncio ..

On Sat, May 9, 2020 at 7:09 AM ratnadeep ray  wrote:

> Thanks Derek for this.
>
> On Friday, 8 May 2020 19:20:31 UTC+5:30, Derek wrote:
>>
>> If you can, use an existing app:
>>
>> https://github.com/wq/django-data-wizard
>>
>>
>> On Friday, 8 May 2020 14:57:43 UTC+2, Kasper Laudrup wrote:
>>>
>>> Hi Ratnadeep,
>>>
>>> On 08/05/2020 14.03, ratnadeep ray wrote:
>>> > Hi all,
>>> >
>>> > Can anyone let me know how to push the fetched data from an excel to
>>> any
>>> > DB using Django?
>>> >
>>>
>>> It's not very clear what you mean by "the fetched data". Have you
>>> fetched some data already? In which format?
>>>
>>> If you need to extract data from an excel sheet, this was the first
>>> guide I could find:
>>>
>>> https://www.geeksforgeeks.org/reading-excel-file-using-python/
>>>
>>> Also, "any DB" is extremely vague. Do you have a database already? Or do
>>> you just want to go for whatever database is the best suited for
>>> whatever you are trying to achieve?
>>>
>>> And what exactly do you want to use Django for? Django is a web
>>> framework and nothing in your question mentions anything about that...
>>>
>>> Kind regards,
>>>
>>> Kasper Laudrup
>>>
>>>
>>>
>>>
>>> --
> 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/4cca72a6-1b5d-4fa8-8c60-c3593cdaca90%40googlegroups.com
> 
> .
>

-- 
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/CAHV4E-e5PRygQvW3Hqs_3yq3FCwPnEnL6x%3DPUH3QP-xzgORhug%40mail.gmail.com.


Re: How to push data fetched from excel to DB using Django?

2020-05-08 Thread ratnadeep ray
Thanks Derek for this. 

On Friday, 8 May 2020 19:20:31 UTC+5:30, Derek wrote:
>
> If you can, use an existing app:
>
> https://github.com/wq/django-data-wizard
>
>
> On Friday, 8 May 2020 14:57:43 UTC+2, Kasper Laudrup wrote:
>>
>> Hi Ratnadeep, 
>>
>> On 08/05/2020 14.03, ratnadeep ray wrote: 
>> > Hi all, 
>> > 
>> > Can anyone let me know how to push the fetched data from an excel to 
>> any 
>> > DB using Django? 
>> > 
>>
>> It's not very clear what you mean by "the fetched data". Have you 
>> fetched some data already? In which format? 
>>
>> If you need to extract data from an excel sheet, this was the first 
>> guide I could find: 
>>
>> https://www.geeksforgeeks.org/reading-excel-file-using-python/ 
>>
>> Also, "any DB" is extremely vague. Do you have a database already? Or do 
>> you just want to go for whatever database is the best suited for 
>> whatever you are trying to achieve? 
>>
>> And what exactly do you want to use Django for? Django is a web 
>> framework and nothing in your question mentions anything about that... 
>>
>> Kind regards, 
>>
>> Kasper Laudrup 
>>
>>
>>
>>
>>

-- 
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/4cca72a6-1b5d-4fa8-8c60-c3593cdaca90%40googlegroups.com.


Re: How to push data fetched from excel to DB using Django?

2020-05-08 Thread ratnadeep ray
Hi Kasper, 

I want to read the data from excel and the retrieved data should be pushed 
to a DB, in my case it's MySQL. 

I believe the steps mentioned in the link 
https://www.geeksforgeeks.org/reading-excel-file-using-python/ , should be 
written in the views.py file. Am I right? 

Please clarify these because I am pretty new to Django. 

Thanks. 

On Friday, 8 May 2020 18:27:43 UTC+5:30, Kasper Laudrup wrote:
>
> Hi Ratnadeep, 
>
> On 08/05/2020 14.03, ratnadeep ray wrote: 
> > Hi all, 
> > 
> > Can anyone let me know how to push the fetched data from an excel to any 
> > DB using Django? 
> > 
>
> It's not very clear what you mean by "the fetched data". Have you 
> fetched some data already? In which format? 
>
> If you need to extract data from an excel sheet, this was the first 
> guide I could find: 
>
> https://www.geeksforgeeks.org/reading-excel-file-using-python/ 
>
> Also, "any DB" is extremely vague. Do you have a database already? Or do 
> you just want to go for whatever database is the best suited for 
> whatever you are trying to achieve? 
>
> And what exactly do you want to use Django for? Django is a web 
> framework and nothing in your question mentions anything about that... 
>
> Kind regards, 
>
> Kasper Laudrup 
>
>
>
>
>

-- 
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/92c1e4f6-35a8-47f2-ab1a-79809fef8b05%40googlegroups.com.


Re: How to push data fetched from excel to DB using Django?

2020-05-08 Thread Derek
If you can, use an existing app:

https://github.com/wq/django-data-wizard


On Friday, 8 May 2020 14:57:43 UTC+2, Kasper Laudrup wrote:
>
> Hi Ratnadeep, 
>
> On 08/05/2020 14.03, ratnadeep ray wrote: 
> > Hi all, 
> > 
> > Can anyone let me know how to push the fetched data from an excel to any 
> > DB using Django? 
> > 
>
> It's not very clear what you mean by "the fetched data". Have you 
> fetched some data already? In which format? 
>
> If you need to extract data from an excel sheet, this was the first 
> guide I could find: 
>
> https://www.geeksforgeeks.org/reading-excel-file-using-python/ 
>
> Also, "any DB" is extremely vague. Do you have a database already? Or do 
> you just want to go for whatever database is the best suited for 
> whatever you are trying to achieve? 
>
> And what exactly do you want to use Django for? Django is a web 
> framework and nothing in your question mentions anything about that... 
>
> Kind regards, 
>
> Kasper Laudrup 
>
>
>
> > -- 
> > 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...@googlegroups.com  
> > . 
> > To view this discussion on the web visit 
> > 
> https://groups.google.com/d/msgid/django-users/1e970207-0c86-4925-b4c8-dbce7c7c069d%40googlegroups.com
>  
> > <
> https://groups.google.com/d/msgid/django-users/1e970207-0c86-4925-b4c8-dbce7c7c069d%40googlegroups.com?utm_medium=email_source=footer>.
>  
>
>

-- 
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/f764f81a-38aa-4a0d-a226-b4988ddf2f54%40googlegroups.com.


Re: How to push data fetched from excel to DB using Django?

2020-05-08 Thread Kasper Laudrup

Hi Ratnadeep,

On 08/05/2020 14.03, ratnadeep ray wrote:

Hi all,

Can anyone let me know how to push the fetched data from an excel to any 
DB using Django?




It's not very clear what you mean by "the fetched data". Have you 
fetched some data already? In which format?


If you need to extract data from an excel sheet, this was the first 
guide I could find:


https://www.geeksforgeeks.org/reading-excel-file-using-python/

Also, "any DB" is extremely vague. Do you have a database already? Or do 
you just want to go for whatever database is the best suited for 
whatever you are trying to achieve?


And what exactly do you want to use Django for? Django is a web 
framework and nothing in your question mentions anything about that...


Kind regards,

Kasper Laudrup




--
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/1e970207-0c86-4925-b4c8-dbce7c7c069d%40googlegroups.com 
.


--
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/6b078fde-fe3d-f24f-f1c5-42a12a337c20%40stacktrace.dk.