From: Steve Atkins <steve@blighty.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: Importing from CSV, auto creating table?
Date: Fri, 23 Aug 2019 11:16:19 +0100
Message-ID: <55fecc3f-813d-9414-8875-d63044a878bf@blighty.com> (raw)
In-Reply-To: <20190821211530.GA1292@panix.com>
References: <20190821211530.GA1292@panix.com>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: steve@blighty.com
Subject: Re: Importing from CSV, auto creating table?
In-Reply-To: <55fecc3f-813d-9414-8875-d63044a878bf@blighty.com>
References: <20190821211530.GA1292@panix.com> <55fecc3f-813d-9414-8875-d63044a878bf@blighty.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox