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

2018-08-16 Thread pavan95
Thank you so much Ron. You saved my efforts after a slight modification of quotes of the command you said, it started working fine. The modified command is as below: cat /tmp/xyz/abc/postgresql-`date --date="0 days ago" +%Y-%m-%d`_*.csv | psql -U aaa -d mydb -c "COPY postgres_log1 FROM STDIN WI

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

2018-08-14 Thread David G. Johnston
On Tuesday, August 14, 2018, Ruiqiang Chen wrote: > CSV file has no limitation of # of rows, excel max row is 2^20. Am I > correct? > It's considered bad form to hijack threads in this manner. Text files have no inherent limits. You can check the Excel documentation for the version you care ab

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

2018-08-14 Thread Adrian Klaver
On 08/14/2018 06: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 &

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

2018-08-14 Thread Ruiqiang Chen
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 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`

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

2018-08-14 Thread Ron
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 &

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

2018-08-14 Thread pavan95
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 requir

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

2018-08-14 Thread Adrian Klaver
On 08/14/2018 06:10 AM, pavan95 wrote: Hi all, I am well versed with the COPY command for copying the contents of a csv file into a table. I am used to the below mentioned command: * COPY postgres_log1 FROM '/tmp/abc/xyz/postgresql-2018-08-14_00.csv' WITH csv;* But in the location "/tmp/ab

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

2018-08-14 Thread pavan95
Hi all, I am well versed with the COPY command for copying the contents of a csv file into a table. I am used to the below mentioned command: * COPY postgres_log1 FROM '/tmp/abc/xyz/postgresql-2018-08-14_00.csv' WITH csv;* But in the location "/tmp/abc/xyz/" daily a file(with header postgres