Hi Markzus, 

 

Issue #5253 <https://code.djangoproject.com/ticket/5253> that you pointed 
me to was indeed very helpful. What I suggested is along the lines of what 
Adam suggested and tried to accomplish 12 years ago, which clearly shows 
that there has been space for its implementation for a very long time. 

 

At the same time, all of the points brought up by Russ also made sense but 
I do think that we can resolve those issues to some extent. Allow me to 
address the little details one by one.

 

Russ pointed out the need for a standardized format in csv files, and in 
turn Adam suggested that the first line begin the table name. I have a 
slightly different suggestion. It is a well known convention to put the 
column names as comma separated values in the first line of the csv file. I 
suggest we leave it at that. 

The column names of the first line will correspond to the fieldnames of the 
model created by the user, which instead of being referenced in the file 
itself can be referenced as a command line argument. 

This of course operates under the assumption that only one table of data 
will be in a single file. Which isn't a very bold assumption to make. I'll 
elaborate on why in just a bit.

 

I'm going to try and do a better job of explain the context of the addition 
I speak of. Say you get your data off of a random site on the internet in 
the form of an Excel sheet. Now if you want to use it in django as a model, 
then right now this is what you'll have to do: Convert it to CSV from 
Excel. Write a script somethink like the one 
https://groups.google.com/g/django-developers/c/o1dFA31YwOk/m/XchFFWjnBQAJ 
talks about (This views file is the code I'm referring to) 
<https://github.com/pmutua/drf_csv_xlsx_file_upload/blob/master/patients/views.py>In
 
which we read line by line and create the objects with a python script and 
make model objects with it. Creating a sub app to only be able to upload 
your dataset into your model seems like a stretch. This process could be 
made seem less if we just made this on the backend of django, which is 
going to take effort but I do think that it will be useful to the user. 

So the whole could simply boil down to `*python manage.py loaddata 
dataset.csv <app>.<ModelName>*`

 

If you consider this then the assumption that one table will correspond to 
a single csv file really is pretty reasonable I think. 

 

So I'm not suggesting that we re-open the issue, I do however think that 
for django which is so user friendly and time efficient, uploading a csv 
file into a table really shouldn't be so long a process. 

 Let me know if I made any sense..

On Friday, 27 November 2020 at 10:55:24 UTC+5:30 Mariusz Felisiak wrote:

> Hi,
>
>     Please take a look at existing ticket #5253 
> <https://code.djangoproject.com/ticket/5253> which was rejected. We 
> should reach a strong consensus on the mailing list to reopen a closed 
> ticket (see triaging guidelines with regards to wontfix tickets 
> <https://docs.djangoproject.com/en/stable/internals/contributing/triaging-tickets/#closing-tickets>),
>  
> but I think that Russ' comment 
> <https://code.djangoproject.com/ticket/5253#comment:25> is still valid.
>
> Best,
> Mariusz
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/fce8a7f9-ef07-4ca1-b32c-d5dbc3345209n%40googlegroups.com.

Reply via email to