Re: Importing from CSV, auto creating table?

From: Reid Thompson <Reid(dot)Thompson(at)omnicell(dot)com>
To: "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Cc: Reid Thompson <Reid(dot)Thompson(at)omnicell(dot)com>
Subject: Re: Importing from CSV, auto creating table?
Date: 2019-08-22 12:25:29
Message-ID: b7ef0c6cc4663333b66bef307714f6ed7c05b843.camel@omnicell.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, 2019-08-21 at 17:15 -0400, stan wrote:
> [EXTERNAL SOURCE]
>
>
>
> I have a situation where we need to import data, as an interim measure,
> from spreadsheets.
>
> I have read up on \copy and COPY, but I do not see that either of these can
> use the header from a CSV file to define a new table. Am I missing
> something?
>
> Also downloaded something called pgfutter, which I thought would do this,
> but have not had any success with this. After I (thought) I had figured out
> the arguments, it just seams to hag forever.
>
>
> --
> "They that would give up essential liberty for temporary safety deserve
> neither liberty nor safety."
> -- Benjamin Franklin
>
>

https://csvkit.readthedocs.io/en/latest/tutorial/3_power_tools.html#csvsql-and-sql2csv-ultimate-power

csvsql and sql2csv: ultimate power
...snip...
By default, csvsql will generate a create table statement for your data. You can specify what sort of database you are using with the -i flag:
...snip...

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Reid Thompson 2019-08-22 13:01:49 Re: Importing from CSV, auto creating table?
Previous Message Arnaud L. 2019-08-22 08:47:22 psql \copy hanging