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 1jlwKy-0002x7-He for pgsql-admin@arkaria.postgresql.org; Thu, 18 Jun 2020 15:20:21 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jlwKx-0001lo-DP for pgsql-admin@arkaria.postgresql.org; Thu, 18 Jun 2020 15:20:19 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jlwKw-0001lZ-JW for pgsql-admin@lists.postgresql.org; Thu, 18 Jun 2020 15:20:19 +0000 Received: from sonic315-13.consmr.mail.bf2.yahoo.com ([74.6.134.123]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jlwKt-0000FK-2B for pgsql-admin@postgresql.org; Thu, 18 Jun 2020 15:20:18 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1592493612; bh=A2pBxJmAZfLc7X4iMVbuZnTVDlv/M/sIzd3fEDza+ZI=; h=Date:From:Reply-To:To:Cc:In-Reply-To:References:Subject:From:Subject; b=nx1fkF1+SQxboPWw95aNgT6UC/iSjR0z5+ones04sQNGe4U5Qz70CzLc0/aMS+9mnhQCcg+ZjAAXjgFiEL60r6h1h8+OVI9gzK7eIwf1gtp4dZ2EO8WKsN4YE6TL4wmQwl+TVyM1NZivPX8sBSMn9+SqgWt5f7Vvx8Mq2J6/nhJmriY+QCPFAsjadDwNNyiHup33vdlzJ3oXd7jxnPFRVjlhB7+FyPIB6uVKEJ6LfQJU3cfVHutBSLez9xaVOIPNg0yWRFUZArHMC7NAXhHGleFB2D5Mom2wMgL0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2VDlXDLm8.yi4UETSQZSq4KLFVfu_ZlegSVGoDLAxWa4hxVVJg f2Qn5K3RHM2Rs_l6DTW3fLq0uKdrXQflqSXgbCB4spAnXvBTLeu_KOjYLY3HEV0VO2K0J7PIU_t7 PSN3LSBKdpVFFI5Cmx.aszbekcft01PcnpV2tS.NdDjpt7C6F2y0NeDgQbyaoIkTr.k_jGK5ps8. QSI.9gcq3df7C9hUoMAzhIbcJ.FYKcZgGVLDvDYck87uVHkSbfREDMy6XSaJrqW.0yFM6YQiUdc4 BClxPH.1RMmgU.CuxLgQECvlNardgCh9Hhl2r8g_ytkdJMYiKcp_G7JEHNshB8iMa3duNQ3kr4jk YskNukEEGHFn.6X67ELnDur8JOtAF.bmssMe62a2ITCqfCanj0MwpAIEQwsInsnlKdgiPuAJSgjA npcNVxtKzACO99TTeuXMC0B5BHQ-- Received: from sonic.gate.mail.ne1.yahoo.com by sonic315.consmr.mail.bf2.yahoo.com with HTTP; Thu, 18 Jun 2020 15:20:12 +0000 Date: Thu, 18 Jun 2020 15:20:07 +0000 (UTC) From: Pepe TD Vo Reply-To: Pepe TD Vo To: Christopher Browne Cc: Pgsql-admin , Pgsql-general Message-ID: <732982585.145357.1592493607620@mail.yahoo.com> In-Reply-To: <1761277119.1163490.1592322138731@mail.yahoo.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> <1718146430.1151531.1592319564343@mail.yahoo.com> <1761277119.1163490.1592322138731@mail.yahoo.com> Subject: Re: create batch script to import into postgres tables MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_145356_1093382831.1592493607617" X-Mailer: WebService/1.1.16138 YMailNorrin Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.106 Safari/537.36 Content-Length: 17549 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk ------=_Part_145356_1093382831.1592493607617 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable I have a Postgresql client installed and connected.=C2=A0 how can i create = a batch script running from the client window? 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, 11:42:40 AM EDT, Pepe TD Vo wrote: =20 =20 Yes, I do have putty installed but can't connect to the aws postgres insta= nce.=C2=A0 Only work for oracle instance.=C2=A0 Only connect postgres insta= nce using pgadmin. follow the url and the login prompt for username and hung there. thank you. 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, 11:17:21 AM EDT, Christopher Browne wrote: =20 =20 =20 On Tue, 16 Jun 2020 at 10:59, Pepe TD Vo wrote: 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? There is no single straightforward answer to that. Supposing I want a batch to either all be processed, or to all not process,= then I might write a sql file like: begin;\copy table_1 (c1, c2, c3) from '/path/tabledata1.csv' csv header;\co= py table_2 (c1, c2, c3) from '/path/tabledata2.csv' csv header;\copy table_= 3 (c1, c2, c3) from '/path/tabledata3.csv' csv header;commit; But you may be fine with having a separate SQL script for each table. There will be conditions where one or the other is more appropriate, and th= at will be based on the requirements of the process. 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. You cannot run psql without having it installed; there is a Windows install= er for PostgreSQL, so you could use that to get it installed. Hopefully there is an installer that will just install PostgreSQL client so= ftware (like psql, pg_dump, and notably *not* the database server software)= ; I don't use WIndows, so I am not too familiar with that. =C2=A0--=20 When confronted by a difficult problem, solve it by reducing it to the question, "How would the Lone Ranger handle this?" =20 ------=_Part_145356_1093382831.1592493607617 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
I have a Postgresql client instal= led and connected.  how can i create a batch script running from the c= lient window?

<= /span>
Bach-Nga

No one in this world is pure and perfect.&nbs= p; If you avoid people for their mistakes you will be alone. So judge less,= love, and forgive more.3D"Emoji"3D"Emoji"3D"Emoji"
To call him a dog hardly seems to do him ju= stice 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 *** Faithf= ul talent *** Sharing success




=20
=20
On Tuesday, June 16, 2020, 11:42:40 AM EDT, Pepe TD Vo = <pepevo@yahoo.com> wrote:


Yes, I do have pu= tty installed but can't connect to the aws postgres instance.  Only wo= rk for oracle instance.  Only connect postgres instance using pgadmin.=

follow the= url and the login prompt for username and hung there.

thank you.

Bach-Nga

No one in this world is pure and perfect.  If you avoid people for t= heir mistakes you will be alone. So judge less, love, and forgive more.3D"Emoji"3D"Emoji"
To call him a dog hardly seems t= o 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)
<= br clear=3D"none">**Live simply **Love gen= erously **Care deeply **Speak kindly.
*** Genuinely ri= ch *** Faithful talent *** Sharing success




=20
=20
On Tuesday, June 16, 2020, 11:17:21 AM EDT, Christopher= Browne <cbbrowne@gmail.com> wrote:



On Tue, 16 Jun 2020 at = 10:59, Pepe TD Vo <pepevo= @yahoo.com> wrote:
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 \copy all csv files import into its own table i= n Linux and in AWS instance. If all csv files into one table is = fine but each csv for each table.  Should I create one bat= ch job for each imported table?  If each batch file import csv to its = table would be fine via \copy table_name(col1,= col2, ... coln) from '/path/tablename.csv' delimiter ',' csv header; =  right?

There is no single straightforward answer to that.

Supposing I want a batch to either all be p= rocessed, or to all not process, then I might write a sql file like:
<= div>
begin;
\copy table_1 (c1, c2, c= 3) from '/path/tabledata1.csv' csv header;
\copy table_2 (c1= , c2, c3) from '/path/tabledata2.csv' csv header;
\copy table_3 (c1, c2, c3) from '/path/tabledata3.csv' csv header;
commit;

But you may be fine wit= h having a separate SQL script for each table.

There will be conditions where one or the other is more appropr= iate, and that will be based on the requirements of the process.

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


You cannot run= psql without having it installed; there is a Windows installer for Postgre= SQL, so you could use that to get it installed.

Hopefully there is an installer that will just install Postgre= SQL client software (like psql, pg_dump, and notably *not* the database ser= ver software); I don't use WIndows, so I am not too familiar with that.
 
--
When confronted by a difficu= lt problem, solve it by reducing it to the
question, "How= would the Lone Ranger handle this?"

------=_Part_145356_1093382831.1592493607617--