Re: Copying data from a CSV file into a table dynamically

From: Ruiqiang Chen <chenrq2005(at)gmail(dot)com>
To: Ron <ronljohnsonjr(at)gmail(dot)com>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Copying data from a CSV file into a table dynamically
Date: 2018-08-14 14:01:35
Message-ID: CA+yjgPTXs9hQfSt4SiMzUxo4U5HxKy2U4NbDT+cwqjZ8gOGeKw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

CSV file has no limitation of # of rows, excel max row is 2^20. Am I
correct?

On Tue, Aug 14, 2018 at 9:46 AM, Ron <ronljohnsonjr(at)gmail(dot)com> wrote:

> On 08/14/2018 08:38 AM, pavan95 wrote:
>
>> Hi Adrian,
>>
>> I tried to use
>> *"COPY postgres_log1 FROM '/tmp/abc/xyz/postgresql-`date --date="0 days
>> ago"
>> +%Y-%m-%d`_*.csv' WITH csv;"*
>>
>> But it resulted in an error. How to issue such that it is understandable
>> by
>> psql?
>>
>> And I am completely unaware of python & psycopg2. Anything which suits my
>> requirement is enough!!ostgresql-archive.org/
>> PostgreSQL-general-f1843780.html
>>
>
> Why not:
> cat /tmp/abc/xyz/postgresql-`date --date="0 days ago"+%Y-%m-%d`_*.csv' | \
> psql YOURDB -c "COPY postgres_log1 FROM STDIN WITH csv;"
>
> --
> Angular momentum makes the world go 'round.
>
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2018-08-14 14:04:31 Re: Copying data from a CSV file into a table dynamically
Previous Message Vik Fearing 2018-08-14 13:58:59 Re: Vacuum process waiting on BufferPin