Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jlD4K-0000U3-0v for pgsql-general@arkaria.postgresql.org; Tue, 16 Jun 2020 15:00:08 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jlD3n-0005jG-9N for pgsql-general@arkaria.postgresql.org; Tue, 16 Jun 2020 14:59:35 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jlD3m-0005j2-J1 for pgsql-general@lists.postgresql.org; Tue, 16 Jun 2020 14:59:35 +0000 Received: from sonic310-14.consmr.mail.bf2.yahoo.com ([74.6.135.124]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jlD3j-0007X3-7Y for pgsql-general@postgresql.org; Tue, 16 Jun 2020 14:59:33 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1592319569; bh=4RTnsrZJCIsJtv00JxrVo/eyebN6dkXW4K3SW2MPsyE=; h=Date:From:Reply-To:To:In-Reply-To:References:Subject:From:Subject; b=r75awuB1THoJdKPcWxT8q4E21KIWNX2FDFBmcA3nAMSPGQ3jJ5xA5qHb2ik040iCstaeA/auKSzotRanGXv48gMQAx2Hv+v2U1+cDFgfuzZjyY0Nh/OheJUjZOxnT3/zgr9CjYTt2Orc0NaG0hZB8kwJnmYw+61qVik9AEvavUBkia4zQYR8BrcXcR1wBZHNpsUUXWHI2R9dv+rUbpHD4gBo64n2dy2G1PyD9F+aOct9wdeGIszgGw/t1Nw7pP8iuQCQsCIcDsFxL6/iONpS+ex0iv4hr3X6rvCo/fhByj3NwT4StegbFwnP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nH6UazCjA5E9YcGh4agFpl bdVtVc9piStCKqRMqaj_T5GuiUXJ2nIT4ofj6940vcny3Qr1X1Whf14hsiAzyoUU9AwnfVdNtWhG bTycA5v9HYKxYQf._5rhUiW_lxUJ4mX_Zf2lG1JtIC0fgiZtH8amt8M.Kfr9hopZYDHfXhiq6yKp 8O2EOoCGoJk.fth2zmXSxEOTmbDVx8F4ZmK7iRJBuArxTlsdkLvuGjsR8kybhb_KABG63TW1e4XQ QtlMU4Aifho806r_.NI0krNpPuavMEIQGqEZdppsYCi7BxcX4aBRC..ivHvUny6RowiRv2TWWEB2 8F.uQsC7M1h9UYOXAPa_cTmwShdlgaD3MoUqf10gcGVsakH26Box9.XqExgTDTFECy_9QCPGilk_ TT4XWZeBicpXbdOjtTMvHLX_SXRo3qKdB.w-- Received: from sonic.gate.mail.ne1.yahoo.com by sonic310.consmr.mail.bf2.yahoo.com with HTTP; Tue, 16 Jun 2020 14:59:29 +0000 Date: Tue, 16 Jun 2020 14:59:24 +0000 (UTC) From: Pepe TD Vo Reply-To: Pepe TD Vo To: Adrian Klaver , Pgsql-general , Pgsql-admin Message-ID: <1718146430.1151531.1592319564343@mail.yahoo.com> In-Reply-To: <3625e291-8456-3831-6205-2d73232bcd1e@aklaver.com> References: <866581879.1147164.1592317256828.ref@mail.yahoo.com> <866581879.1147164.1592317256828@mail.yahoo.com> <1f5f4fd6-ad22-4823-c922-17a021c2c0d7@aklaver.com> <74046808.1129536.1592317823808@mail.yahoo.com> <3625e291-8456-3831-6205-2d73232bcd1e@aklaver.com> Subject: Re: create batch script to import into postgres tables MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_1151530_1286301316.1592319564340" X-Mailer: WebService/1.1.16119 YMailNorrin Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36 Content-Length: 16780 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk ------=_Part_1151530_1286301316.1592319564340 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable I can run \copy=C2=A0in Linux with individual csv file into the table fine = and run import using pgadmin into AWS instance.=C2=A0=C2=A0I am trying to r= un \copy all csv files import into its own table in Linux and in AWS instan= ce.=C2=A0If all csv files into one table is fine but each csv for each tabl= e.=C2=A0=C2=A0Should I create one batch job for each imported table?=C2=A0 = If each batch file import csv to its table would be fine via=C2=A0\copy tab= le_name(col1, col2, ... coln) from '/path/tablename.csv' delimiter ',' csv = header;=C2=A0=C2=A0right? Also, the problem is I can't pull/execute psql from window client to pull t= he psql in aws instance and don't know how to create the batch script for t= his run.=C2=A0 I tried simple \copy pull from c:\tes.csv and psql is unknow= n. Bach-Nga No one in this world is pure and perfect.=C2=A0 If you avoid people for the= ir mistakes you will be alone. So judge less, love, and forgive more.To cal= l him a dog hardly seems to do him justice though in as much as he had four= legs, a tail, and barked, I admit he was, to all outward appearances. But = to those who knew him well, he was a perfect gentleman (Hermione Gingold) **Live simply **Love generously **Care deeply **Speak kindly.*** Genuinely = rich *** Faithful talent *** Sharing success =20 On Tuesday, June 16, 2020, 10:39:45 AM EDT, Adrian Klaver wrote: =20 =20 On 6/16/20 7:30 AM, Pepe TD Vo wrote: Please post to list also. Ccing list. > using psql in AWS instance > also psql in Linux.=C2=A0 I can run psql in linux if create a batch file,= but=20 > don't know how to pull psql in aws instance if the batch script run in=20 > Window client.=C2=A0 Also, I need help to pull each csv import to its own= =20 > table.=C2=A0 Should I create each batch script for each import table? So the AWS instance and Linux instance are different? To me the simplest solution would be to push the CSV files to the AWS=20 instance and work from there. The files will need to be run through a=20 Postgres command to be imported into a table. Are you familiar with=20 COPY(https://www.postgresql.org/docs/12/sql-copy.html) or=20 \copy(https://www.postgresql.org/docs/12/app-psql.html)? >=20 > ** > *Bach-Nga >=20 > *No one in this world is pure and perfect.=C2=A0 If you avoid people for= =20 > their mistakes you will be alone. So judge less, love, and forgive=20 > more.EmojiEmojiEmoji > To call him a dog hardly seems to do him justice though in as much as he= =20 > had four legs, a tail, and barked, I admit he was, to all outward=20 > appearances. But to those who knew him well, he was a perfect gentleman= =20 > (Hermione Gingold) >=20 > **Live simply **Love generously **Care deeply **Speak kindly. > *** Genuinely rich *** Faithful talent *** Sharing success >=20 >=20 >=20 >=20 > On Tuesday, June 16, 2020, 10:25:03 AM EDT, Adrian Klaver=20 > wrote: >=20 >=20 > On 6/16/20 7:20 AM, Pepe TD Vo wrote: >=C2=A0 > good morning experts, >=C2=A0 > >=C2=A0 > I n=C3=AAd to set up a batch script to import multi csv files to = import them >=C2=A0 > to Postgres tables.=C2=A0 Each csv files will be named table1_tod= aydate.csv, >=C2=A0 > table2_todaydate.csv, etc... tablen_todaydate.csv.=C2=A0 Each csv= file will >=C2=A0 > import to its table and how do I execute the script to called psq= l from >=C2=A0 > AWS?=C2=A0 Do I need to create each batch file for import each ta= ble? >=20 > You have psql installed on your local(Windows?) machine? >=20 > Or are you using psql in your AWS instance? >=20 >=C2=A0 > >=C2=A0 > all export file is store in c:\export\files\ >=C2=A0 > >=C2=A0 > thank you. >=C2=A0 > >=C2=A0 > Bach-Nga >=C2=A0 > >=C2=A0 > >=C2=A0 > >=C2=A0 > >=C2=A0 > >=C2=A0 > >=C2=A0 > ** >=C2=A0 > *Bach-Nga >=C2=A0 > >=C2=A0 > *No one in this world is pure and perfect.=C2=A0 If you avoid peo= ple for >=C2=A0 > their mistakes you will be alone. So judge less, love, and forgiv= e >=C2=A0 > more.EmojiEmojiEmoji >=20 >=C2=A0 > To call him a dog hardly seems to do him justice though in as muc= h as he >=C2=A0 > had four legs, a tail, and barked, I admit he was, to all outward >=C2=A0 > appearances. But to those who knew him well, he was a perfect gen= tleman >=C2=A0 > (Hermione Gingold) >=C2=A0 > >=C2=A0 > **Live simply **Love generously **Care deeply **Speak kindly. >=C2=A0 > *** Genuinely rich *** Faithful talent *** Sharing success >=20 >=C2=A0 > >=C2=A0 > >=20 >=20 > --=20 > Adrian Klaver > adrian.klaver@aklaver.com >=20 --=20 Adrian Klaver adrian.klaver@aklaver.com =20 ------=_Part_1151530_1286301316.1592319564340 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
I can run \copy = in Linux with individual csv file into the table fine and run import using = pgadmin into AWS instance.  I am trying to run \cop= y all csv files import into its own table in Linux and in AWS instance.&nbs= p;If all csv files into one table is fine but each csv for each table= .  Should I create one batch job for each imported table?&= nbsp; If each batch file import csv to its table would be fine via \copy table_name(col1, col2, ... coln) from '/path/tab= lename.csv' delimiter ',' csv header;  right?

=
Also, the problem is I can't pull/execute psql from w= indow client to pull the psql in aws instance and don't know how to create = the batch script for this run.  I tried simple \copy pull from c:\tes.csv and psql is unknown.

<= /div>

Bach-Nga

No one in this world is pure and perfect.  If you avoid= people for their mistakes you will be alone. So judge less, love, and forg= ive more.3D"Emoji"=3D"Emoji"3D"Emoji"
To call him a dog hardly seems to do him justice though = in as much as he had four legs, a tail, and barked, I admit he was, to all = outward appearances. But to those who knew him well, he was a perfect gentl= eman (Hermione Gingold)

**Live simply **Love generously **Care deeply **Speak kindly.=
*** Genuinely rich *** Faithful talent ***= Sharing success




=20
=20
On Tuesday, June 16, 2020, 10:39:45 AM EDT, Adrian Klav= er <adrian.klaver@aklaver.com> wrote:


On 6/16/20 7:30 AM, Pepe TD Vo wrote:=
Please post to list also.
Ccing list.<= br clear=3D"none">
> using psql in AWS instance
> also psql in Linux.  I can run psql in linux if creat= e a batch file, but
> don't know how to pull psql in = aws instance if the batch script run in
> Window clie= nt.  Also, I need help to pull each csv import to its own
> table.  Should I create each batch script for each import = table?

So the AWS instance and Linux i= nstance are different?

To me the simpl= est solution would be to push the CSV files to the AWS
i= nstance and work from there. The files will need to be run through a
Postgres command to be imported into a table.

Are you familiar with
COPY(https://www.postgresql.org/docs/12/sql-copy.html) or
\copy(https://www.postgresql.org/docs/12/ap= p-psql.html)?


&= gt;
> **
> *Bach-Nga
>
> *No one in this world is pure and perfe= ct.  If you avoid people for
> their mistakes yo= u will be alone. So judge less, love, and forgive
> m= ore.EmojiEmojiEmoji
> To call him a dog hardly seems t= o do him justice though in as much as he
> had four l= egs, a tail, and barked, I admit he was, to all outward
= > appearances. But to those who knew him well, he was a perfect gentlema= n
> (Hermione Gingold)
>
> **Live simply **Love generously **Care deeply **Speak kind= ly.
> *** Genuinely rich *** Faithful talent *** Shari= ng success
>
>
>
>
> On Tuesday, June 16,= 2020, 10:25:03 AM EDT, Adrian Klaver
> <adrian.klaver@aklaver.com> wrote:
>
>
> On 6/16/20 7:20 = AM, Pepe TD Vo wrote:
>  > good morning expert= s,
>  >
>  > I n= =C3=AAd to set up a batch script to import multi csv files to import them>  > to Postgres tables.  Each csv files w= ill be named table1_todaydate.csv,
>  > table2= _todaydate.csv, etc... tablen_todaydate.csv.  Each csv file will
>  > import to its table and how do I execute the s= cript to called psql from
>  > AWS?  Do I= need to create each batch file for import each table?
&g= t;
> You have psql installed on your local(Windows?) = machine?
>
> Or are you using ps= ql in your AWS instance?
>
>&nbs= p; >
>  > all export file is store in c:\ex= port\files\
>  >
>  = > thank you.
>  >
>&nb= sp; > Bach-Nga
>  >
>&= nbsp; >
>  >
>  &= gt;
>  >
>  >
>  > **
>  > *Bach-N= ga
>  >
>  > *No = one in this world is pure and perfect.  If you avoid people for
>  > their mistakes you will be alone. So judge less= , love, and forgive
>  > more.EmojiEmojiEmoji<= br clear=3D"none">>
>  > To call him a dog= hardly seems to do him justice though in as much as he
&= gt;  > had four legs, a tail, and barked, I admit he was, to all ou= tward
>  > appearances. But to those who knew = him well, he was a perfect gentleman
>  > (Her= mione Gingold)
>  >
>&nbs= p; > **Live simply **Love generously **Care deeply **Speak kindly.
>  > *** Genuinely rich *** Faithful talent *** Sha= ring success
>
>  >
>  >
>
>= ;
> --
> Adrian Klaver
> adrian.klaver@aklaver.com = <mailto:adrian.klaver@aklaver.com><= div class=3D"yqt6354987531" id=3D"yqtfd19189">
>


--
A= drian Klaver
adrian.klaver@= aklaver.com
------=_Part_1151530_1286301316.1592319564340--