Another approach is to use postgres' COPY command:
https://www.postgresql.org/docs/9.6/static/sql-copy.html
which knows how to parse and import tab-delimited files (and is crazy
fast). Then, once the table exists, use Django's `inspectdb` management
command to generate a Model corresponding to
Thanks you two. I'll check out that parser.
On Monday, January 8, 2018 at 9:38:44 PM UTC-5, Tom Tanner wrote:
>
> I have a tab-delimited data file that looks something like this:
>
>
> NAME S1903_C02_001E state county tract State-County-Tract-ID
> Census Tract 201, Autauga County, Alabama 66000
Kasper,
You are correct :-), I just assumed (probably incorrectly) that the data
was just like his example - in that case it would have been easiest :-)
Regards,
Andréas
2018-01-09 9:27 GMT+01:00 Kasper Laudrup :
> Hi,
>
> On 2018-01-09 08:09, Andréas Kühne wrote:
>
>>
Hi,
On 2018-01-09 08:09, Andréas Kühne wrote:
You will have to parse the CSV file manually with a custom management
command (at least that is what I would do). All you need to do is open
the file, split each row with a "," and then import the correct columns
to the model.
Unfortunately,
Hi,
You will have to parse the CSV file manually with a custom management
command (at least that is what I would do). All you need to do is open the
file, split each row with a "," and then import the correct columns to the
model.
You can also use something like pandas to convert the CSV file
I have a tab-delimited data file that looks something like this:
NAME S1903_C02_001E state county tract State-County-Tract-ID
Census Tract 201, Autauga County, Alabama 66000 01 001 020100 01001020100
Census Tract 202, Autauga County, Alabama 41107 01 001 020200 01001020200
Census Tract 203,
6 matches
Mail list logo