Re: Importing from CSV, auto creating table?

From: Steve Atkins <steve(at)blighty(dot)com>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Importing from CSV, auto creating table?
Date: 2019-08-23 10:16:19
Message-ID: 55fecc3f-813d-9414-8875-d63044a878bf@blighty.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 21/08/2019 22:15, stan wrote:
> 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.
>
You might find https://github.com/wttw/csvpg useful. It creates tables
with column names based on the CSV header, and data types intuited from
the data.

(The only pre-built binary there is for Mac right now; I should at least
add one for Windows).

Cheers,
  Steve

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Devrim Gündüz 2019-08-23 10:38:14 Re: How to install Postgres 12 beta with YUM
Previous Message Georg H. 2019-08-23 07:00:36 Re: Question on pgwatch