pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feedcreate batch script to import into postgres tables
32+ messages / 6 participants
[nested] [flat]
* create batch script to import into postgres tables
@ 2020-06-16 14:20 Pepe TD Vo <pepevo@yahoo.com>
2020-06-16 14:24 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
0 siblings, 1 reply; 32+ messages in thread
From: Pepe TD Vo @ 2020-06-16 14:20 UTC (permalink / raw)
To: Pgsql-general <pgsql-general@postgresql.org>; pgsql-admin
good morning experts,
I nêd to set up a batch script to import multi csv files to import them to Postgres tables. Each csv files will 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 script to called psql from AWS? Do I need to create each batch file for import each table?
all export file is store in c:\export\files\
thank you.
Bach-Nga
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 forgive more.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 gentleman (Hermione Gingold)
**Live simply **Love generously **Care deeply **Speak kindly.*** Genuinely rich *** Faithful talent *** Sharing success
^ permalink raw reply [nested|flat] 32+ messages in thread
* Re: create batch script to import into postgres tables
2020-06-16 14:20 create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
@ 2020-06-16 14:24 ` Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-16 14:59 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
0 siblings, 1 reply; 32+ messages in thread
From: Adrian Klaver @ 2020-06-16 14:24 UTC (permalink / raw)
To: Pepe TD Vo <pepevo@yahoo.com>; Pgsql-general <pgsql-general@postgresql.org>; pgsql-admin
On 6/16/20 7:20 AM, Pepe TD Vo wrote:
> good morning experts,
>
> I nêd to set up a batch script to import multi csv files to import them
> to Postgres tables. Each csv files will 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 script to called psql from
> AWS? Do I need to create each batch file for import each table?
You have psql installed on your local(Windows?) machine?
Or are you using psql in your AWS instance?
>
> all export file is store in c:\export\files\
>
> thank you.
>
> Bach-Nga
>
>
>
>
>
>
> **
> *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 forgive
> more.EmojiEmojiEmoji
> 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 gentleman
> (Hermione Gingold)
>
> **Live simply **Love generously **Care deeply **Speak kindly.
> *** Genuinely rich *** Faithful talent *** Sharing success
>
>
--
Adrian Klaver
adrian.klaver@aklaver.com
^ permalink raw reply [nested|flat] 32+ messages in thread
* Re: create batch script to import into postgres tables
2020-06-16 14:20 create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-16 14:24 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
@ 2020-06-16 14:59 ` Pepe TD Vo <pepevo@yahoo.com>
2020-06-16 15:11 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-16 15:16 ` Re: create batch script to import into postgres tables Christopher Browne <cbbrowne@gmail.com>
0 siblings, 2 replies; 32+ messages in thread
From: Pepe TD Vo @ 2020-06-16 14:59 UTC (permalink / raw)
To: Adrian Klaver <adrian.klaver@aklaver.com>; Pgsql-general <pgsql-general@postgresql.org>; pgsql-admin
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 in Linux and in AWS instance. 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? 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?
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. I tried simple \copy pull from c:\tes.csv and psql is unknown.
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 forgive more.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 gentleman (Hermione Gingold)
**Live simply **Love generously **Care deeply **Speak kindly.*** Genuinely rich *** Faithful talent *** Sharing success
On Tuesday, June 16, 2020, 10:39:45 AM EDT, Adrian Klaver <adrian.klaver@aklaver.com> wrote:
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. I can run psql in linux if create a batch file, but
> don't know how to pull psql in aws instance if the batch script run in
> Window client. 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 instance are different?
To me the simplest solution would be to push the CSV files to the AWS
instance 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/app-psql.html)?
>
> **
> *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 forgive
> more.EmojiEmojiEmoji
> 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 gentleman
> (Hermione Gingold)
>
> **Live simply **Love generously **Care deeply **Speak kindly.
> *** Genuinely rich *** Faithful talent *** Sharing 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 experts,
> >
> > I nêd to set up a batch script to import multi csv files to import them
> > to Postgres tables. Each csv files will 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 script to called psql from
> > AWS? Do I need to create each batch file for import each table?
>
> You have psql installed on your local(Windows?) machine?
>
> Or are you using psql in your AWS instance?
>
> >
> > all export file is store in c:\export\files\
> >
> > thank you.
> >
> > Bach-Nga
> >
> >
> >
> >
> >
> >
> > **
> > *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 forgive
> > more.EmojiEmojiEmoji
>
> > 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 gentleman
> > (Hermione Gingold)
> >
> > **Live simply **Love generously **Care deeply **Speak kindly.
> > *** Genuinely rich *** Faithful talent *** Sharing success
>
> >
> >
>
>
> --
> Adrian Klaver
> adrian.klaver@aklaver.com <mailto:adrian.klaver@aklaver.com>
>
--
Adrian Klaver
adrian.klaver@aklaver.com
^ permalink raw reply [nested|flat] 32+ messages in thread
* Re: create batch script to import into postgres tables
2020-06-16 14:20 create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-16 14:24 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-16 14:59 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
@ 2020-06-16 15:11 ` Adrian Klaver <adrian.klaver@aklaver.com>
1 sibling, 0 replies; 32+ messages in thread
From: Adrian Klaver @ 2020-06-16 15:11 UTC (permalink / raw)
To: Pepe TD Vo <pepevo@yahoo.com>; Pgsql-general <pgsql-general@postgresql.org>; pgsql-admin
On 6/16/20 7:59 AM, Pepe TD Vo wrote:
Just noticed you cross posted to pgsql-admin listed. FYI, That is not a
good practice.
> 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 in Linux and in AWS instance. 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? 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?
Yes, you will need to copy each file into its own table.
>
> 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. I tried simple \copy pull from c:\tes.csv and psql
> is unknown.
There is no good/easy way I know of to install just psql on Windows. You
are better off copying the CSV files to the AWS instance.
Do you have PuTTY installed?:
https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html
If not I would take a look at above link. PuTTY brings SSH to Windows.
The relevant part to this issue is:
https://the.earth.li/~sgtatham/putty/0.73/htmldoc/Chapter5.html#pscp
"PSCP, the PuTTY Secure Copy client, is a tool for transferring files
securely between computers using an SSH connection. "
>
>
> **
> *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 forgive
> more.EmojiEmojiEmoji
> 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 gentleman
> (Hermione Gingold)
>
> **Live simply **Love generously **Care deeply **Speak kindly.
> *** Genuinely rich *** Faithful talent *** Sharing success
>
>
>
>
> On Tuesday, June 16, 2020, 10:39:45 AM EDT, Adrian Klaver
> <adrian.klaver@aklaver.com> wrote:
>
>
> 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. I can run psql in linux if create a batch file, but
> > don't know how to pull psql in aws instance if the batch script run in
> > Window client. 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 instance are different?
>
> To me the simplest solution would be to push the CSV files to the AWS
> instance 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/app-psql.html)?
>
>
> >
> > **
> > *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 forgive
> > more.EmojiEmojiEmoji
> > 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 gentleman
> > (Hermione Gingold)
> >
> > **Live simply **Love generously **Care deeply **Speak kindly.
> > *** Genuinely rich *** Faithful talent *** Sharing success
> >
> >
> >
> >
> > On Tuesday, June 16, 2020, 10:25:03 AM EDT, Adrian Klaver
> > <adrian.klaver@aklaver.com <mailto:adrian.klaver@aklaver.com>> wrote:
> >
> >
> > On 6/16/20 7:20 AM, Pepe TD Vo wrote:
> > > good morning experts,
> > >
> > > I nêd to set up a batch script to import multi csv files to import
> them
> > > to Postgres tables. Each csv files will 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 script to called psql
> from
> > > AWS? Do I need to create each batch file for import each table?
> >
> > You have psql installed on your local(Windows?) machine?
> >
> > Or are you using psql in your AWS instance?
> >
> > >
> > > all export file is store in c:\export\files\
> > >
> > > thank you.
> > >
> > > Bach-Nga
> > >
> > >
> > >
> > >
> > >
> > >
> > > **
> > > *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 forgive
> > > more.EmojiEmojiEmoji
> >
> > > 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
> gentleman
> > > (Hermione Gingold)
> > >
> > > **Live simply **Love generously **Care deeply **Speak kindly.
> > > *** Genuinely rich *** Faithful talent *** Sharing success
> >
> > >
> > >
> >
> >
> > --
> > Adrian Klaver
> > adrian.klaver@aklaver.com <mailto:adrian.klaver@aklaver.com>
> <mailto:adrian.klaver@aklaver.com <mailto:adrian.klaver@aklaver.com>>
>
> >
>
>
> --
> Adrian Klaver
> adrian.klaver@aklaver.com <mailto:adrian.klaver@aklaver.com>
--
Adrian Klaver
adrian.klaver@aklaver.com
^ permalink raw reply [nested|flat] 32+ messages in thread
* Re: create batch script to import into postgres tables
2020-06-16 14:20 create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-16 14:24 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-16 14:59 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
@ 2020-06-16 15:16 ` Christopher Browne <cbbrowne@gmail.com>
2020-06-16 15:42 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
1 sibling, 1 reply; 32+ messages in thread
From: Christopher Browne @ 2020-06-16 15:16 UTC (permalink / raw)
To: Pepe TD Vo <pepevo@yahoo.com>; +Cc: pgsql-admin
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 in Linux and in AWS instance. 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? 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 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;
\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 with having a separate SQL script for each table.
There will be conditions where one or the other is more appropriate, 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. 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 PostgreSQL, so you could use that to get it installed.
Hopefully there is an installer that will just install PostgreSQL client
software (like psql, pg_dump, and notably *not* the database server
software); I don't use WIndows, so I am not too familiar with that.
--
When confronted by a difficult problem, solve it by reducing it to the
question, "How would the Lone Ranger handle this?"
^ permalink raw reply [nested|flat] 32+ messages in thread
* Re: create batch script to import into postgres tables
2020-06-16 14:20 create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-16 14:24 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-16 14:59 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-16 15:16 ` Re: create batch script to import into postgres tables Christopher Browne <cbbrowne@gmail.com>
@ 2020-06-16 15:42 ` Pepe TD Vo <pepevo@yahoo.com>
2020-06-18 15:20 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
0 siblings, 1 reply; 32+ messages in thread
From: Pepe TD Vo @ 2020-06-16 15:42 UTC (permalink / raw)
To: Christopher Browne <cbbrowne@gmail.com>; +Cc: pgsql-admin
Yes, I do have putty installed but can't connect to the aws postgres instance. Only work 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 their mistakes you will be alone. So judge less, love, and forgive more.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 gentleman (Hermione Gingold)
**Live simply **Love generously **Care deeply **Speak kindly.*** Genuinely rich *** Faithful talent *** Sharing success
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 in Linux and in AWS instance. 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? 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 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;\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 with having a separate SQL script for each table.
There will be conditions where one or the other is more appropriate, 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. 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 PostgreSQL, so you could use that to get it installed.
Hopefully there is an installer that will just install PostgreSQL client software (like psql, pg_dump, and notably *not* the database server software); I don't use WIndows, so I am not too familiar with that.
--
When confronted by a difficult problem, solve it by reducing it to the
question, "How would the Lone Ranger handle this?"
^ permalink raw reply [nested|flat] 32+ messages in thread
* Re: create batch script to import into postgres tables
2020-06-16 14:20 create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-16 14:24 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-16 14:59 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-16 15:16 ` Re: create batch script to import into postgres tables Christopher Browne <cbbrowne@gmail.com>
2020-06-16 15:42 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
@ 2020-06-18 15:20 ` Pepe TD Vo <pepevo@yahoo.com>
2020-06-18 16:08 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
0 siblings, 1 reply; 32+ messages in thread
From: Pepe TD Vo @ 2020-06-18 15:20 UTC (permalink / raw)
To: Christopher Browne <cbbrowne@gmail.com>; +Cc: pgsql-admin; Pgsql-general <pgsql-general@postgresql.org>
I have a Postgresql client installed and connected. how can i create a batch script running from the client window?
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 forgive more.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 gentleman (Hermione Gingold)
**Live simply **Love generously **Care deeply **Speak kindly.*** Genuinely rich *** Faithful talent *** Sharing success
On Tuesday, June 16, 2020, 11:42:40 AM EDT, Pepe TD Vo <pepevo@yahoo.com> wrote:
Yes, I do have putty installed but can't connect to the aws postgres instance. Only work 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 their mistakes you will be alone. So judge less, love, and forgive more.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 gentleman (Hermione Gingold)
**Live simply **Love generously **Care deeply **Speak kindly.*** Genuinely rich *** Faithful talent *** Sharing success
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 in Linux and in AWS instance. 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? 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 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;\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 with having a separate SQL script for each table.
There will be conditions where one or the other is more appropriate, 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. 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 PostgreSQL, so you could use that to get it installed.
Hopefully there is an installer that will just install PostgreSQL client software (like psql, pg_dump, and notably *not* the database server software); I don't use WIndows, so I am not too familiar with that.
--
When confronted by a difficult problem, solve it by reducing it to the
question, "How would the Lone Ranger handle this?"
^ permalink raw reply [nested|flat] 32+ messages in thread
* Re: create batch script to import into postgres tables
2020-06-16 14:20 create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-16 14:24 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-16 14:59 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-16 15:16 ` Re: create batch script to import into postgres tables Christopher Browne <cbbrowne@gmail.com>
2020-06-16 15:42 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-18 15:20 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
@ 2020-06-18 16:08 ` Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-18 16:40 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
0 siblings, 1 reply; 32+ messages in thread
From: Adrian Klaver @ 2020-06-18 16:08 UTC (permalink / raw)
To: Pepe TD Vo <pepevo@yahoo.com>; Christopher Browne <cbbrowne@gmail.com>; +Cc: pgsql-admin; Pgsql-general <pgsql-general@postgresql.org>
On 6/18/20 8:20 AM, Pepe TD Vo wrote:
Please don't top post. The preferred style on this list is inline or
bottom posting(https://en.wikipedia.org/wiki/Posting_style).
> I have a Postgresql client installed and connected. how can i create a
> batch script running from the client window?
Create a file with commands in it like the example from Christopher
Browne that was posted earlier:
"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;
\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 with having a separate SQL script for each table.
There will be conditions where one or the other is more appropriate, and
that will be based on the requirements of the process."
Then point psql at it:
psql -d some_db -h some_host -U some_user -f the_file
Be aware that \copy is all or nothing. If there is a single failure in
the copying the whole copy will rollback. Given that the one file per
table might be preferable.
>
> **
> *Bach-Nga
>
--
Adrian Klaver
adrian.klaver@aklaver.com
^ permalink raw reply [nested|flat] 32+ messages in thread
* Re: create batch script to import into postgres tables
2020-06-16 14:20 create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-16 14:24 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-16 14:59 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-16 15:16 ` Re: create batch script to import into postgres tables Christopher Browne <cbbrowne@gmail.com>
2020-06-16 15:42 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-18 15:20 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-18 16:08 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
@ 2020-06-18 16:40 ` Pepe TD Vo <pepevo@yahoo.com>
2020-06-18 19:06 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
0 siblings, 1 reply; 32+ messages in thread
From: Pepe TD Vo @ 2020-06-18 16:40 UTC (permalink / raw)
To: Christopher Browne <cbbrowne@gmail.com>; Adrian Klaver <adrian.klaver@aklaver.com>; +Cc: pgsql-admin; Pgsql-general <pgsql-general@postgresql.org>
I get this part that separates SQL script for import each table,
(import.sql)begin;
\copy table_1 (c1, c2, c3) from '/path/tabledata1.csv' csv header;
commit;
but when open the psql sql shell script it prompts line by line for localhost, port, db, user, and password. If I set up a script and let it run it won't connect to the postgresql instance. I want to know how to execute a batch script connect to the database/instance. In oracle I created a shell script with all oracle_sid, oracle_home, and read the function/procedure... for psql, especially from window client, I did put psql_home and connect to the instance, it failed
c:\Progra~1\PostgreSQL\11\bin\psql -d PSCIDR -h localhost -p 5432 -U postgres -i import.sql
even I do a simple count
c:\Progra~1\PostgreSQL\11\bin\psql -d PSCIDR -h localhost -p 5432 -U postgres -c "select count(*) from tableA";
none of them is work. Try to learn how to execute its script.
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 forgive more.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 gentleman (Hermione Gingold)
**Live simply **Love generously **Care deeply **Speak kindly.*** Genuinely rich *** Faithful talent *** Sharing success
On Thursday, June 18, 2020, 12:08:44 PM EDT, Adrian Klaver <adrian.klaver@aklaver.com> wrote:
On 6/18/20 8:20 AM, Pepe TD Vo wrote:
Please don't top post. The preferred style on this list is inline or
bottom posting(https://en.wikipedia.org/wiki/Posting_style).
> I have a Postgresql client installed and connected. how can i create a
> batch script running from the client window?
Create a file with commands in it like the example from Christopher
Browne that was posted earlier:
"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;
\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 with having a separate SQL script for each table.
There will be conditions where one or the other is more appropriate, and
that will be based on the requirements of the process."
Then point psql at it:
psql -d some_db -h some_host -U some_user -f the_file
Be aware that \copy is all or nothing. If there is a single failure in
the copying the whole copy will rollback. Given that the one file per
table might be preferable.
>
> **
> *Bach-Nga
>
--
Adrian Klaver
adrian.klaver@aklaver.com
^ permalink raw reply [nested|flat] 32+ messages in thread
* Re: create batch script to import into postgres tables
2020-06-16 14:20 create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-16 14:24 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-16 14:59 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-16 15:16 ` Re: create batch script to import into postgres tables Christopher Browne <cbbrowne@gmail.com>
2020-06-16 15:42 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-18 15:20 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-18 16:08 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-18 16:40 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
@ 2020-06-18 19:06 ` Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-18 19:54 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
0 siblings, 1 reply; 32+ messages in thread
From: Adrian Klaver @ 2020-06-18 19:06 UTC (permalink / raw)
To: Pepe TD Vo <pepevo@yahoo.com>; Christopher Browne <cbbrowne@gmail.com>; +Cc: pgsql-admin; Pgsql-general <pgsql-general@postgresql.org>
On 6/18/20 9:40 AM, Pepe TD Vo wrote:
> I get this part that separates SQL script for import each table,
>
> (import.sql)
> begin;
> \copy table_1 (c1, c2, c3) from '/path/tabledata1.csv' csv header;
> commit;
>
> but when open the psql sql shell script it prompts line by line for
> localhost, port, db, user, and password. If I set up a script and let
> it run it won't connect to the postgresql instance. I want to know how
> to execute a batch script connect to the database/instance.
> In oracle I created a shell script with all oracle_sid, oracle_home, and
> read the function/procedure... for psql, especially from window client,
> I did put psql_home and connect to the instance, it failed
>
> c:\Progra~1\PostgreSQL\11\bin\psql -d PSCIDR -h localhost -p 5432 -U
> postgres -i import.sql
The above should be -f import.sql. AFAIK there is no -i for psql, so
that should be failing.
>
> even I do a simple count
>
> c:\Progra~1\PostgreSQL\11\bin\psql -d PSCIDR -h localhost -p 5432 -U
> postgres -c "select count(*) from tableA";
psql -d production -U postgres -c 'select count(*) from cell_per';
Null display is "NULL".
count
-------
68
(1 row)
psql -d production -U postgres -c 'select count(*) from cell_per'
Null display is "NULL".
count
-------
68
psql -d production -U postgres -c 'select count(*) from cell_per;'
Null display is "NULL".
count
-------
68
>
> none of them is work. Try to learn how to execute its script.
What error messages do you get?
>
> **
> *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 forgive
> more.EmojiEmojiEmoji
> 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 gentleman
> (Hermione Gingold)
>
> **Live simply **Love generously **Care deeply **Speak kindly.
> *** Genuinely rich *** Faithful talent *** Sharing success
>
>
>
>
> On Thursday, June 18, 2020, 12:08:44 PM EDT, Adrian Klaver
> <adrian.klaver@aklaver.com> wrote:
>
>
> On 6/18/20 8:20 AM, Pepe TD Vo wrote:
>
> Please don't top post. The preferred style on this list is inline or
> bottom posting(https://en.wikipedia.org/wiki/Posting_style).
>
> > I have a Postgresql client installed and connected. how can i create a
> > batch script running from the client window?
>
> Create a file with commands in it like the example from Christopher
> Browne that was posted earlier:
>
> "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;
> \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 with having a separate SQL script for each table.
>
>
> There will be conditions where one or the other is more appropriate, and
> that will be based on the requirements of the process."
>
> Then point psql at it:
>
> psql -d some_db -h some_host -U some_user -f the_file
>
> Be aware that \copy is all or nothing. If there is a single failure in
> the copying the whole copy will rollback. Given that the one file per
> table might be preferable.
>
>
> >
> > **
> > *Bach-Nga
>
> >
>
>
>
> --
> Adrian Klaver
> adrian.klaver@aklaver.com <mailto:adrian.klaver@aklaver.com>
>
>
>
--
Adrian Klaver
adrian.klaver@aklaver.com
^ permalink raw reply [nested|flat] 32+ messages in thread
* Re: create batch script to import into postgres tables
2020-06-16 14:20 create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-16 14:24 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-16 14:59 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-16 15:16 ` Re: create batch script to import into postgres tables Christopher Browne <cbbrowne@gmail.com>
2020-06-16 15:42 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-18 15:20 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-18 16:08 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-18 16:40 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-18 19:06 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
@ 2020-06-18 19:54 ` Pepe TD Vo <pepevo@yahoo.com>
2020-06-18 23:00 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
0 siblings, 1 reply; 32+ messages in thread
From: Pepe TD Vo @ 2020-06-18 19:54 UTC (permalink / raw)
To: Christopher Browne <cbbrowne@gmail.com>; Adrian Klaver <adrian.klaver@aklaver.com>; +Cc: pgsql-admin; Pgsql-general <pgsql-general@postgresql.org>
>>psql -d production -U postgres -c 'select count(*) from cell_per';
Null display is "NULL".
count
-------
68
(1 row)
you can do this once you are in psql. But if you are running from shell script, it will be an error
>>What error messages do you get?
my shell script is:@echo off C:\Program Files\PostgreSQL\11\bin\psql -U PSmasteruser -d PSCIDR -h hostname.amazonaws.com -p 5432 -c "select count(*) from tableA;"
pause
the error I have is 'C:\Program' is not recognized as an internal or external command, operable program or batch file.
I even surround the path in quotes because of space.@echo off cmd /c ""C:\Program Files\PostgreSQL\11\bin\psql" -U PSmasteruser -d PSCIDR -h hostname.amazonaws.com -p 5432 -c "select count(*) from tableA;"
pause
error is: 'C:\Program Files\PostgreSQL\11\bin\psql: illegal option -- u
when I put -P Password123 (or fully qualified password=Password123)
it gives me another error "pset: unknow option: Password123psql: could not set printing parameter "Password123"
I can connect from psql shell fine when it prompt hostname, username (but connect to postgres not to PSmasteruser, PSmasteruser username set up for aws maintenance postgres database, someone did, not me and the password is same on both). Once I'm in psql and I can change to PSCIDR instance fine and run select count(*) from tableA;
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 forgive more.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 gentleman (Hermione Gingold)
**Live simply **Love generously **Care deeply **Speak kindly.*** Genuinely rich *** Faithful talent *** Sharing success
On Thursday, June 18, 2020, 03:06:39 PM EDT, Adrian Klaver <adrian.klaver@aklaver.com> wrote:
On 6/18/20 9:40 AM, Pepe TD Vo wrote:
> I get this part that separates SQL script for import each table,
>
> (import.sql)
> begin;
> \copy table_1 (c1, c2, c3) from '/path/tabledata1.csv' csv header;
> commit;
>
> but when open the psql sql shell script it prompts line by line for
> localhost, port, db, user, and password. If I set up a script and let
> it run it won't connect to the postgresql instance. I want to know how
> to execute a batch script connect to the database/instance.
> In oracle I created a shell script with all oracle_sid, oracle_home, and
> read the function/procedure... for psql, especially from window client,
> I did put psql_home and connect to the instance, it failed
>
> c:\Progra~1\PostgreSQL\11\bin\psql -d PSCIDR -h localhost -p 5432 -U
> postgres -i import.sql
The above should be -f import.sql. AFAIK there is no -i for psql, so
that should be failing.
>
> even I do a simple count
>
> c:\Progra~1\PostgreSQL\11\bin\psql -d PSCIDR -h localhost -p 5432 -U
> postgres -c "select count(*) from tableA";
psql -d production -U postgres -c 'select count(*) from cell_per';
Null display is "NULL".
count
-------
68
(1 row)
psql -d production -U postgres -c 'select count(*) from cell_per'
Null display is "NULL".
count
-------
68
psql -d production -U postgres -c 'select count(*) from cell_per;'
Null display is "NULL".
count
-------
68
>
> none of them is work. Try to learn how to execute its script.
What error messages do you get?
>
> **
> *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 forgive
> more.EmojiEmojiEmoji
> 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 gentleman
> (Hermione Gingold)
>
> **Live simply **Love generously **Care deeply **Speak kindly.
> *** Genuinely rich *** Faithful talent *** Sharing success
>
>
>
>
> On Thursday, June 18, 2020, 12:08:44 PM EDT, Adrian Klaver
> <adrian.klaver@aklaver.com> wrote:
>
>
> On 6/18/20 8:20 AM, Pepe TD Vo wrote:
>
> Please don't top post. The preferred style on this list is inline or
> bottom posting(https://en.wikipedia.org/wiki/Posting_style).
>
> > I have a Postgresql client installed and connected. how can i create a
> > batch script running from the client window?
>
> Create a file with commands in it like the example from Christopher
> Browne that was posted earlier:
>
> "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;
> \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 with having a separate SQL script for each table.
>
>
> There will be conditions where one or the other is more appropriate, and
> that will be based on the requirements of the process."
>
> Then point psql at it:
>
> psql -d some_db -h some_host -U some_user -f the_file
>
> Be aware that \copy is all or nothing. If there is a single failure in
> the copying the whole copy will rollback. Given that the one file per
> table might be preferable.
>
>
> >
> > **
> > *Bach-Nga
>
> >
>
>
>
> --
> Adrian Klaver
> adrian.klaver@aklaver.com <mailto:adrian.klaver@aklaver.com>
>
>
>
--
Adrian Klaver
adrian.klaver@aklaver.com
^ permalink raw reply [nested|flat] 32+ messages in thread
* Re: create batch script to import into postgres tables
2020-06-16 14:20 create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-16 14:24 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-16 14:59 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-16 15:16 ` Re: create batch script to import into postgres tables Christopher Browne <cbbrowne@gmail.com>
2020-06-16 15:42 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-18 15:20 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-18 16:08 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-18 16:40 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-18 19:06 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-18 19:54 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
@ 2020-06-18 23:00 ` Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-18 23:37 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
0 siblings, 1 reply; 32+ messages in thread
From: Adrian Klaver @ 2020-06-18 23:00 UTC (permalink / raw)
To: Pepe TD Vo <pepevo@yahoo.com>; Christopher Browne <cbbrowne@gmail.com>; +Cc: pgsql-admin; Pgsql-general <pgsql-general@postgresql.org>
On 6/18/20 12:54 PM, Pepe TD Vo wrote:
>>>psql -d production -U postgres -c 'select count(*) from cell_per';
> Null display is "NULL".
> count
> -------
> 68
> (1 row)
>
> you can do this once you are in psql. But if you are running from shell
> script, it will be an error
>
> >>What error messages do you get?
>
> my shell script is:
> @echo off
> C:\Program Files\PostgreSQL\11\bin\psql -U PSmasteruser -d PSCIDR -h
> hostname.amazonaws.com -p 5432 -c "select count(*) from tableA;"
> pause
>
> the error I have is 'C:\Program' is not recognized as an internal or
> external command, operable program or batch file.
>
> I even surround the path in quotes because of space.
> @echo off
> cmd /c ""C:\Program Files\PostgreSQL\11\bin\psql" -U PSmasteruser -d
> PSCIDR -h hostname.amazonaws.com -p 5432 -c "select count(*) from tableA;"
> pause
Not sure how quoting works in Windows shell scripts, but pretty sure the
above has unbalanced quotes.
>
> error is: 'C:\Program Files\PostgreSQL\11\bin\psql: illegal option -- u
>
> when I put -P Password123 (or fully qualified password=Password123)
I would recommend spending some time here:
https://www.postgresql.org/docs/12/app-psql.html
to see what the options are. Hint: -P is not the option for password.
>
> it gives me another error "pset: unknow option: Password123
> psql: could not set printing parameter "Password123"
It is the option for pset as the error message says.
>
> I can connect from psql shell fine when it prompt hostname, username
> (but connect to postgres not to PSmasteruser, PSmasteruser username set
> up for aws maintenance postgres database, someone did, not me and the
> password is same on both). Once I'm in psql and I can change to PSCIDR
> instance fine and run select count(*) from tableA;
>
>
>
> **
> *Bach-Nga
>
--
Adrian Klaver
adrian.klaver@aklaver.com
^ permalink raw reply [nested|flat] 32+ messages in thread
* Re: create batch script to import into postgres tables
2020-06-16 14:20 create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-16 14:24 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-16 14:59 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-16 15:16 ` Re: create batch script to import into postgres tables Christopher Browne <cbbrowne@gmail.com>
2020-06-16 15:42 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-18 15:20 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-18 16:08 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-18 16:40 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-18 19:06 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-18 19:54 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-18 23:00 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
@ 2020-06-18 23:37 ` Pepe TD Vo <pepevo@yahoo.com>
2020-06-19 00:00 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
0 siblings, 1 reply; 32+ messages in thread
From: Pepe TD Vo @ 2020-06-18 23:37 UTC (permalink / raw)
To: Christopher Browne <cbbrowne@gmail.com>; Adrian Klaver <adrian.klaver@aklaver.com>; +Cc: pgsql-admin; Pgsql-general <pgsql-general@postgresql.org>
thank you for the link. I did try it and it's still errorecho 'SELECT count(*) FROM tableA;' | C:\Program Files\PostgreSQL\11\bin\psql -U PSmasteruser -d PSCIDR -h hostname.amazonaws.com -p 5432
I can run 'psql -u postgres -d PSCIDR -p 5432' (on Linux server, still learning how to run it from psql shell in Window) fine from psql prompt. Just still wonder how to connect directly to the instance PSCIDR from scripting in both aws and linux. Otherwise manually run using pgAdmin.
v/r,
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 forgive more.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 gentleman (Hermione Gingold)
**Live simply **Love generously **Care deeply **Speak kindly.*** Genuinely rich *** Faithful talent *** Sharing success
On Thursday, June 18, 2020, 07:00:37 PM EDT, Adrian Klaver <adrian.klaver@aklaver.com> wrote:
On 6/18/20 12:54 PM, Pepe TD Vo wrote:
>>>psql -d production -U postgres -c 'select count(*) from cell_per';
> Null display is "NULL".
> count
> -------
> 68
> (1 row)
>
> you can do this once you are in psql. But if you are running from shell
> script, it will be an error
>
> >>What error messages do you get?
>
> my shell script is:
> @echo off
> C:\Program Files\PostgreSQL\11\bin\psql -U PSmasteruser -d PSCIDR -h
> hostname.amazonaws.com -p 5432 -c "select count(*) from tableA;"
> pause
>
> the error I have is 'C:\Program' is not recognized as an internal or
> external command, operable program or batch file.
>
> I even surround the path in quotes because of space.
> @echo off
> cmd /c ""C:\Program Files\PostgreSQL\11\bin\psql" -U PSmasteruser -d
> PSCIDR -h hostname.amazonaws.com -p 5432 -c "select count(*) from tableA;"
> pause
Not sure how quoting works in Windows shell scripts, but pretty sure the
above has unbalanced quotes.
>
> error is: 'C:\Program Files\PostgreSQL\11\bin\psql: illegal option -- u
>
> when I put -P Password123 (or fully qualified password=Password123)
I would recommend spending some time here:
https://www.postgresql.org/docs/12/app-psql.html
to see what the options are. Hint: -P is not the option for password.
>
> it gives me another error "pset: unknow option: Password123
> psql: could not set printing parameter "Password123"
It is the option for pset as the error message says.
>
> I can connect from psql shell fine when it prompt hostname, username
> (but connect to postgres not to PSmasteruser, PSmasteruser username set
> up for aws maintenance postgres database, someone did, not me and the
> password is same on both). Once I'm in psql and I can change to PSCIDR
> instance fine and run select count(*) from tableA;
>
>
>
> **
> *Bach-Nga
>
--
Adrian Klaver
adrian.klaver@aklaver.com
^ permalink raw reply [nested|flat] 32+ messages in thread
* Re: create batch script to import into postgres tables
2020-06-16 14:20 create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-16 14:24 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-16 14:59 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-16 15:16 ` Re: create batch script to import into postgres tables Christopher Browne <cbbrowne@gmail.com>
2020-06-16 15:42 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-18 15:20 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-18 16:08 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-18 16:40 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-18 19:06 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-18 19:54 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-18 23:00 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-18 23:37 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
@ 2020-06-19 00:00 ` Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-19 01:25 ` Re: create batch script to import into postgres tables cgerard999@gmail.com
0 siblings, 1 reply; 32+ messages in thread
From: Adrian Klaver @ 2020-06-19 00:00 UTC (permalink / raw)
To: Pepe TD Vo <pepevo@yahoo.com>; Christopher Browne <cbbrowne@gmail.com>; +Cc: pgsql-admin; Pgsql-general <pgsql-general@postgresql.org>
On 6/18/20 4:37 PM, Pepe TD Vo wrote:
> thank you for the link. I did try it and it's still error
>
> echo 'SELECT count(*) FROM tableA;' |
> C:\Program Files\PostgreSQL\11\bin\psql -U PSmasteruser -d PSCIDR -h
> hostname.amazonaws.com -p 5432
This is getting old. The error is?
>
> I can run 'psql -u postgres -d PSCIDR -p 5432' (on Linux server, still
> learning how to run it from psql shell in Window) fine from psql
> prompt. Just still wonder how to connect directly to the instance
> PSCIDR from scripting in both aws and linux. Otherwise manually run
> using pgAdmin.
>
> v/r,
>
> **
> *Bach-Nga
>
--
Adrian Klaver
adrian.klaver@aklaver.com
^ permalink raw reply [nested|flat] 32+ messages in thread
* Re: create batch script to import into postgres tables
2020-06-16 14:20 create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-16 14:24 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-16 14:59 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-16 15:16 ` Re: create batch script to import into postgres tables Christopher Browne <cbbrowne@gmail.com>
2020-06-16 15:42 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-18 15:20 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-18 16:08 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-18 16:40 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-18 19:06 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-18 19:54 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-18 23:00 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-18 23:37 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-19 00:00 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
@ 2020-06-19 01:25 ` cgerard999@gmail.com
2020-06-19 11:12 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
0 siblings, 1 reply; 32+ messages in thread
From: cgerard999@gmail.com @ 2020-06-19 01:25 UTC (permalink / raw)
To: Adrian Klaver <adrian.klaver@aklaver.com>; +Cc: Pepe TD Vo <pepevo@yahoo.com>; Christopher Browne <cbbrowne@gmail.com>; pgsql-admin; Pgsql-general <pgsql-general@postgresql.org>
Remove the quotes around echo
echo select count(*) from web_20200619; | "C:\Program Files\postgresql\11\bin\psql" -d *** -h *** -U ***
or, store your query into a text file and use
psql -f query.sql
Sent from my mobile phone
> Le 19 juin 2020 à 02:00, Adrian Klaver <adrian.klaver@aklaver.com> a écrit :
>
> On 6/18/20 4:37 PM, Pepe TD Vo wrote:
>> thank you for the link. I did try it and it's still error
>> echo 'SELECT count(*) FROM tableA;' |
>> C:\Program Files\PostgreSQL\11\bin\psql -U PSmasteruser -d PSCIDR -h hostname.amazonaws.com -p 5432
>
>
> This is getting old. The error is?
>> I can run 'psql -u postgres -d PSCIDR -p 5432' (on Linux server, still learning how to run it from psql shell in Window) fine from psql prompt. Just still wonder how to connect directly to the instance PSCIDR from scripting in both aws and linux. Otherwise manually run using pgAdmin.
>> v/r,
>> **
>> *Bach-Nga
>
>
> --
> Adrian Klaver
> adrian.klaver@aklaver.com
>
>
^ permalink raw reply [nested|flat] 32+ messages in thread
* Re: create batch script to import into postgres tables
2020-06-16 14:20 create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-16 14:24 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-16 14:59 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-16 15:16 ` Re: create batch script to import into postgres tables Christopher Browne <cbbrowne@gmail.com>
2020-06-16 15:42 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-18 15:20 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-18 16:08 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-18 16:40 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-18 19:06 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-18 19:54 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-18 23:00 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-18 23:37 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-19 00:00 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-19 01:25 ` Re: create batch script to import into postgres tables cgerard999@gmail.com
@ 2020-06-19 11:12 ` Pepe TD Vo <pepevo@yahoo.com>
2020-06-19 13:19 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
0 siblings, 1 reply; 32+ messages in thread
From: Pepe TD Vo @ 2020-06-19 11:12 UTC (permalink / raw)
To: Adrian Klaver <adrian.klaver@aklaver.com>; cgerard999@gmail.com; +Cc: Christopher Browne <cbbrowne@gmail.com>; pgsql-admin; Pgsql-general <pgsql-general@postgresql.org>
thank you, I tried that too, remove the quote around the echo and it prompt for password, as I mentioned no matter I put -P mypassword no matter what I spell out password=mypassword still argument error
>>echo select count(*) from tableA; | "C:\Program Files\PostgreSQL\11\bin\psql" -U PSmasteruser -d PSCIDR -h hostname.amazonaws.com -p 5432
>> echo select count(*) from tableA; | "C:\Program Files\PostgreSQL\11\bin\psql" -U PSmasteruser -d PSCIDR -h hostname.amazonaws.com -p 5432 password=mypassword
all usernames are same password.
thank you so much for all input.
v/r,
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 forgive more.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 gentleman (Hermione Gingold)
**Live simply **Love generously **Care deeply **Speak kindly.*** Genuinely rich *** Faithful talent *** Sharing success
On Thursday, June 18, 2020, 09:25:41 PM EDT, <cgerard999@gmail.com> wrote:
Remove the quotes around echo
echo select count(*) from web_20200619; | "C:\Program Files\postgresql\11\bin\psql" -d *** -h *** -U ***
or, store your query into a text file and use
psql -f query.sql
Sent from my mobile phone
Le 19 juin 2020 à 02:00, Adrian Klaver <adrian.klaver@aklaver.com> a écrit :
On 6/18/20 4:37 PM, Pepe TD Vo wrote:
thank you for the link. I did try it and it's still error
echo 'SELECT count(*) FROM tableA;' |
C:\Program Files\PostgreSQL\11\bin\psql -U PSmasteruser -d PSCIDR -h hostname.amazonaws.com -p 5432
This is getting old. The error is?
I can run 'psql -u postgres -d PSCIDR -p 5432' (on Linux server, still learning how to run it from psql shell in Window) fine from psql prompt. Just still wonder how to connect directly to the instance PSCIDR from scripting in both aws and linux. Otherwise manually run using pgAdmin.
v/r,
**
*Bach-Nga
--
Adrian Klaver
adrian.klaver@aklaver.com
^ permalink raw reply [nested|flat] 32+ messages in thread
* Re: create batch script to import into postgres tables
2020-06-16 14:20 create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-16 14:24 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-16 14:59 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-16 15:16 ` Re: create batch script to import into postgres tables Christopher Browne <cbbrowne@gmail.com>
2020-06-16 15:42 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-18 15:20 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-18 16:08 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-18 16:40 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-18 19:06 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-18 19:54 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-18 23:00 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-18 23:37 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-19 00:00 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-19 01:25 ` Re: create batch script to import into postgres tables cgerard999@gmail.com
2020-06-19 11:12 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
@ 2020-06-19 13:19 ` Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-19 13:53 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
0 siblings, 1 reply; 32+ messages in thread
From: Adrian Klaver @ 2020-06-19 13:19 UTC (permalink / raw)
To: Pepe TD Vo <pepevo@yahoo.com>; cgerard999@gmail.com; +Cc: Christopher Browne <cbbrowne@gmail.com>; pgsql-admin; Pgsql-general <pgsql-general@postgresql.org>
On 6/19/20 4:12 AM, Pepe TD Vo wrote:
> thank you, I tried that too, remove the quote around the echo and it
> prompt for password, as I mentioned no matter I put -P mypassword no
> matter what I spell out password=mypassword still argument error
Once again -P has nothing to do with password. Also --password does not
take an argument, it is meant to be used as is. The purpose is to force
a password prompt. This is all spelled out here:
https://www.postgresql.org/docs/12/app-psql.html
Also spelled out in above is:
" It is also convenient to have a ~/.pgpass file to avoid regularly
having to type in passwords. See Section 33.15 for more information."
And Section 33.15:
https://www.postgresql.org/docs/12/libpq-pgpass.html
"The file .pgpass in a user's home directory can contain passwords to be
used if the connection requires a password (and no password has been
specified otherwise). ..."
Read more at link for how to do that.
>
> >>echo select count(*) from tableA; | "C:\Program
> Files\PostgreSQL\11\bin\psql" -U PSmasteruser -d PSCIDR -h
> hostname.amazonaws.com -p 5432
>
> >> echo select count(*) from tableA; | "C:\Program
> Files\PostgreSQL\11\bin\psql" -U PSmasteruser -d PSCIDR -h
> hostname.amazonaws.com -p 5432 password=mypassword
>
> all usernames are same password.
>
> thank you so much for all input.
>
> v/r,
>
> **
> *Bach-Nga
--
Adrian Klaver
adrian.klaver@aklaver.com
^ permalink raw reply [nested|flat] 32+ messages in thread
* Re: create batch script to import into postgres tables
2020-06-16 14:20 create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-16 14:24 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-16 14:59 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-16 15:16 ` Re: create batch script to import into postgres tables Christopher Browne <cbbrowne@gmail.com>
2020-06-16 15:42 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-18 15:20 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-18 16:08 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-18 16:40 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-18 19:06 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-18 19:54 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-18 23:00 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-18 23:37 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-19 00:00 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-19 01:25 ` Re: create batch script to import into postgres tables cgerard999@gmail.com
2020-06-19 11:12 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-19 13:19 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
@ 2020-06-19 13:53 ` Pepe TD Vo <pepevo@yahoo.com>
2020-06-19 13:58 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
0 siblings, 1 reply; 32+ messages in thread
From: Pepe TD Vo @ 2020-06-19 13:53 UTC (permalink / raw)
To: cgerard999@gmail.com, Adrian Klaver <adrian.klaver@aklaver.com>; +Cc: Christopher Browne <cbbrowne@gmail.com>; pgsql-admin; Pgsql-general <pgsql-general@postgresql.org>
Thank you sir and I am sorry for the typo not having "--" on password. I did spelling out with --password=mypassword
>> echo select count(*) from tableA; | "C:\Program Files\PostgreSQL\11\bin\psql" -U PSmasteruser -d PSCIDR -h hostname.amazonaws.com -p 5432 --password=mypassword
even -W for password>> echo select count(*) from tableA; | "C:\Program Files\PostgreSQL\11\bin\psql" -U PSmasteruser -d PSCIDR -h hostname.amazonaws.com -p 5432 -W=mypassword
none of them work, still prompt me for password to type in. I will look into the pgpassfile which I know it will fail again.
very respectfully,
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 forgive more.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 gentleman (Hermione Gingold)
**Live simply **Love generously **Care deeply **Speak kindly.*** Genuinely rich *** Faithful talent *** Sharing success
On Friday, June 19, 2020, 09:19:35 AM EDT, Adrian Klaver <adrian.klaver@aklaver.com> wrote:
On 6/19/20 4:12 AM, Pepe TD Vo wrote:
> thank you, I tried that too, remove the quote around the echo and it
> prompt for password, as I mentioned no matter I put -P mypassword no
> matter what I spell out password=mypassword still argument error
Once again -P has nothing to do with password. Also --password does not
take an argument, it is meant to be used as is. The purpose is to force
a password prompt. This is all spelled out here:
https://www.postgresql.org/docs/12/app-psql.html
Also spelled out in above is:
" It is also convenient to have a ~/.pgpass file to avoid regularly
having to type in passwords. See Section 33.15 for more information."
And Section 33.15:
https://www.postgresql.org/docs/12/libpq-pgpass.html
"The file .pgpass in a user's home directory can contain passwords to be
used if the connection requires a password (and no password has been
specified otherwise). ..."
Read more at link for how to do that.
>
> >>echo select count(*) from tableA; | "C:\Program
> Files\PostgreSQL\11\bin\psql" -U PSmasteruser -d PSCIDR -h
> hostname.amazonaws.com -p 5432
>
> >> echo select count(*) from tableA; | "C:\Program
> Files\PostgreSQL\11\bin\psql" -U PSmasteruser -d PSCIDR -h
> hostname.amazonaws.com -p 5432 password=mypassword
>
> all usernames are same password.
>
> thank you so much for all input.
>
> v/r,
>
> **
> *Bach-Nga
--
Adrian Klaver
adrian.klaver@aklaver.com
^ permalink raw reply [nested|flat] 32+ messages in thread
* Re: create batch script to import into postgres tables
2020-06-16 14:20 create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-16 14:24 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-16 14:59 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-16 15:16 ` Re: create batch script to import into postgres tables Christopher Browne <cbbrowne@gmail.com>
2020-06-16 15:42 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-18 15:20 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-18 16:08 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-18 16:40 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-18 19:06 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-18 19:54 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-18 23:00 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-18 23:37 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-19 00:00 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-19 01:25 ` Re: create batch script to import into postgres tables cgerard999@gmail.com
2020-06-19 11:12 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-19 13:19 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-19 13:53 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
@ 2020-06-19 13:58 ` Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-19 14:52 ` Re: create batch script to import into postgres tables David G. Johnston <david.g.johnston@gmail.com>
0 siblings, 1 reply; 32+ messages in thread
From: Adrian Klaver @ 2020-06-19 13:58 UTC (permalink / raw)
To: Pepe TD Vo <pepevo@yahoo.com>; cgerard999@gmail.com; +Cc: Christopher Browne <cbbrowne@gmail.com>; pgsql-admin; Pgsql-general <pgsql-general@postgresql.org>
On 6/19/20 6:53 AM, Pepe TD Vo wrote:
> Thank you sir and I am sorry for the typo not having "--" on password.
> I did spelling out with --password=mypassword
Please go back and read my post again.
>
>>> echo select count(*) from tableA; | "C:\Program
> Files\PostgreSQL\11\bin\psql" -U PSmasteruser -d PSCIDR -h
> hostname.amazonaws.com -p 5432 --password=mypassword
>
> even -W for password
>>> echo select count(*) from tableA; | "C:\Program
> Files\PostgreSQL\11\bin\psql" -U PSmasteruser -d PSCIDR -h
> hostname.amazonaws.com -p 5432 -W=mypassword
>
> none of them work, still prompt me for password to type in. I will look
> into the pgpassfile which I know it will fail again.
>
>
> very respectfully,
>
> **
> *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 forgive
> more.EmojiEmojiEmoji
> 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 gentleman
> (Hermione Gingold)
>
> **Live simply **Love generously **Care deeply **Speak kindly.
> *** Genuinely rich *** Faithful talent *** Sharing success
>
>
>
>
> On Friday, June 19, 2020, 09:19:35 AM EDT, Adrian Klaver
> <adrian.klaver@aklaver.com> wrote:
>
>
> On 6/19/20 4:12 AM, Pepe TD Vo wrote:
> > thank you, I tried that too, remove the quote around the echo and it
> > prompt for password, as I mentioned no matter I put -P mypassword no
> > matter what I spell out password=mypassword still argument error
>
> Once again -P has nothing to do with password. Also --password does not
> take an argument, it is meant to be used as is. The purpose is to force
> a password prompt. This is all spelled out here:
>
> https://www.postgresql.org/docs/12/app-psql.html
>
> Also spelled out in above is:
>
> " It is also convenient to have a ~/.pgpass file to avoid regularly
> having to type in passwords. See Section 33.15 for more information."
>
> And Section 33.15:
>
> https://www.postgresql.org/docs/12/libpq-pgpass.html
>
> "The file .pgpass in a user's home directory can contain passwords to be
> used if the connection requires a password (and no password has been
> specified otherwise). ..."
>
> Read more at link for how to do that.
>
>
> >
> > >>echo select count(*) from tableA; | "C:\Program
> > Files\PostgreSQL\11\bin\psql" -U PSmasteruser -d PSCIDR -h
> > hostname.amazonaws.com -p 5432
> >
> > >> echo select count(*) from tableA; | "C:\Program
> > Files\PostgreSQL\11\bin\psql" -U PSmasteruser -d PSCIDR -h
> > hostname.amazonaws.com -p 5432 password=mypassword
> >
> > all usernames are same password.
> >
> > thank you so much for all input.
> >
> > v/r,
> >
> > **
> > *Bach-Nga
>
> --
> Adrian Klaver
> adrian.klaver@aklaver.com <mailto:adrian.klaver@aklaver.com>
>
>
--
Adrian Klaver
adrian.klaver@aklaver.com
^ permalink raw reply [nested|flat] 32+ messages in thread
* Re: create batch script to import into postgres tables
2020-06-16 14:20 create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-16 14:24 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-16 14:59 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-16 15:16 ` Re: create batch script to import into postgres tables Christopher Browne <cbbrowne@gmail.com>
2020-06-16 15:42 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-18 15:20 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-18 16:08 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-18 16:40 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-18 19:06 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-18 19:54 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-18 23:00 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-18 23:37 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-19 00:00 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-19 01:25 ` Re: create batch script to import into postgres tables cgerard999@gmail.com
2020-06-19 11:12 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-19 13:19 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-19 13:53 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-19 13:58 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
@ 2020-06-19 14:52 ` David G. Johnston <david.g.johnston@gmail.com>
2020-06-19 14:57 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
0 siblings, 1 reply; 32+ messages in thread
From: David G. Johnston @ 2020-06-19 14:52 UTC (permalink / raw)
To: Adrian Klaver <adrian.klaver@aklaver.com>; +Cc: Pepe TD Vo <pepevo@yahoo.com>; cgerard999@gmail.com, Christopher Browne <cbbrowne@gmail.com>; pgsql-admin; Pgsql-general <pgsql-general@postgresql.org>
On Fri, Jun 19, 2020 at 6:58 AM Adrian Klaver <adrian.klaver@aklaver.com>
wrote:
> On 6/19/20 6:53 AM, Pepe TD Vo wrote:
> > Thank you sir and I am sorry for the typo not having "--" on password.
> > I did spelling out with --password=mypassword
>
> Please go back and read my post again.
>
To be clear, there is no way to supply a password as a command line
argument. It is fundamentally a bad idea and we don't even make it an
option.
You need to decide on one of the actual ways of supplying a password, or
choose an alternative authentication method like peer.
David J.
^ permalink raw reply [nested|flat] 32+ messages in thread
* Re: create batch script to import into postgres tables
2020-06-16 14:20 create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-16 14:24 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-16 14:59 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-16 15:16 ` Re: create batch script to import into postgres tables Christopher Browne <cbbrowne@gmail.com>
2020-06-16 15:42 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-18 15:20 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-18 16:08 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-18 16:40 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-18 19:06 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-18 19:54 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-18 23:00 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-18 23:37 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-19 00:00 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-19 01:25 ` Re: create batch script to import into postgres tables cgerard999@gmail.com
2020-06-19 11:12 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-19 13:19 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-19 13:53 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-19 13:58 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-19 14:52 ` Re: create batch script to import into postgres tables David G. Johnston <david.g.johnston@gmail.com>
@ 2020-06-19 14:57 ` Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-19 15:07 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
0 siblings, 1 reply; 32+ messages in thread
From: Adrian Klaver @ 2020-06-19 14:57 UTC (permalink / raw)
To: David G. Johnston <david.g.johnston@gmail.com>; +Cc: Pepe TD Vo <pepevo@yahoo.com>; cgerard999@gmail.com, Christopher Browne <cbbrowne@gmail.com>; pgsql-admin; Pgsql-general <pgsql-general@postgresql.org>
On 6/19/20 7:52 AM, David G. Johnston wrote:
> On Fri, Jun 19, 2020 at 6:58 AM Adrian Klaver <adrian.klaver@aklaver.com
> <mailto:adrian.klaver@aklaver.com>> wrote:
>
> On 6/19/20 6:53 AM, Pepe TD Vo wrote:
> > Thank you sir and I am sorry for the typo not having "--" on
> password.
> > I did spelling out with --password=mypassword
>
> Please go back and read my post again.
>
>
> To be clear, there is no way to supply a password as a command line
> argument. It is fundamentally a bad idea and we don't even make it an
> option.
Actually that is not entirely true, see my follow up post.
>
> You need to decide on one of the actual ways of supplying a password, or
> choose an alternative authentication method like peer.
>
> David J.
>
--
Adrian Klaver
adrian.klaver@aklaver.com
^ permalink raw reply [nested|flat] 32+ messages in thread
* Re: create batch script to import into postgres tables
2020-06-16 14:20 create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-16 14:24 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-16 14:59 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-16 15:16 ` Re: create batch script to import into postgres tables Christopher Browne <cbbrowne@gmail.com>
2020-06-16 15:42 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-18 15:20 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-18 16:08 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-18 16:40 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-18 19:06 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-18 19:54 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-18 23:00 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-18 23:37 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-19 00:00 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-19 01:25 ` Re: create batch script to import into postgres tables cgerard999@gmail.com
2020-06-19 11:12 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-19 13:19 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-19 13:53 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-19 13:58 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-19 14:52 ` Re: create batch script to import into postgres tables David G. Johnston <david.g.johnston@gmail.com>
2020-06-19 14:57 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
@ 2020-06-19 15:07 ` Pepe TD Vo <pepevo@yahoo.com>
2020-06-19 15:30 ` Re: create batch script to import into postgres tables cgerard999@gmail.com
0 siblings, 1 reply; 32+ messages in thread
From: Pepe TD Vo @ 2020-06-19 15:07 UTC (permalink / raw)
To: David G. Johnston <david.g.johnston@gmail.com>; Adrian Klaver <adrian.klaver@aklaver.com>; +Cc: cgerard999@gmail.com, Christopher Browne <cbbrowne@gmail.com>; pgsql-admin; Pgsql-general <pgsql-general@postgresql.org>
appreciate for clarification, all inputs and teaching me more in PostgreSQL
have a good weekend and happy father's day to all who is Father.
v/r,
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 forgive more.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 gentleman (Hermione Gingold)
**Live simply **Love generously **Care deeply **Speak kindly.*** Genuinely rich *** Faithful talent *** Sharing success
On Friday, June 19, 2020, 10:57:59 AM EDT, Adrian Klaver <adrian.klaver@aklaver.com> wrote:
On 6/19/20 7:52 AM, David G. Johnston wrote:
> On Fri, Jun 19, 2020 at 6:58 AM Adrian Klaver <adrian.klaver@aklaver.com
> <mailto:adrian.klaver@aklaver.com>> wrote:
>
> On 6/19/20 6:53 AM, Pepe TD Vo wrote:
> > Thank you sir and I am sorry for the typo not having "--" on
> password.
> > I did spelling out with --password=mypassword
>
> Please go back and read my post again.
>
>
> To be clear, there is no way to supply a password as a command line
> argument. It is fundamentally a bad idea and we don't even make it an
> option.
Actually that is not entirely true, see my follow up post.
>
> You need to decide on one of the actual ways of supplying a password, or
> choose an alternative authentication method like peer.
>
> David J.
>
--
Adrian Klaver
adrian.klaver@aklaver.com
^ permalink raw reply [nested|flat] 32+ messages in thread
* Re: create batch script to import into postgres tables
2020-06-16 14:20 create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-16 14:24 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-16 14:59 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-16 15:16 ` Re: create batch script to import into postgres tables Christopher Browne <cbbrowne@gmail.com>
2020-06-16 15:42 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-18 15:20 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-18 16:08 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-18 16:40 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-18 19:06 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-18 19:54 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-18 23:00 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-18 23:37 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-19 00:00 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-19 01:25 ` Re: create batch script to import into postgres tables cgerard999@gmail.com
2020-06-19 11:12 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-19 13:19 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-19 13:53 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-19 13:58 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-19 14:52 ` Re: create batch script to import into postgres tables David G. Johnston <david.g.johnston@gmail.com>
2020-06-19 14:57 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-19 15:07 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
@ 2020-06-19 15:30 ` cgerard999@gmail.com
2020-06-19 18:23 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
0 siblings, 1 reply; 32+ messages in thread
From: cgerard999@gmail.com @ 2020-06-19 15:30 UTC (permalink / raw)
To: Pepe TD Vo <pepevo@yahoo.com>; +Cc: David G. Johnston <david.g.johnston@gmail.com>; Adrian Klaver <adrian.klaver@aklaver.com>; Christopher Browne <cbbrowne@gmail.com>; pgsql-admin; Pgsql-general <pgsql-general@postgresql.org>
There is an alternate solution, which is to launch pgadmin GUI, connect to the database, tick « save password »
Then psql won’t prompt fir password any more.
Pay however attention to the security concern.
Sent from my mobile phone
> Le 19 juin 2020 à 17:07, Pepe TD Vo <pepevo@yahoo.com> a écrit :
>
>
> appreciate for clarification, all inputs and teaching me more in PostgreSQL
>
> have a good weekend and happy father's day to all who is Father.
>
> v/r,
>
> 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 forgive more.
> 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 gentleman (Hermione Gingold)
>
> **Live simply **Love generously **Care deeply **Speak kindly.
> *** Genuinely rich *** Faithful talent *** Sharing success
>
>
>
>
> On Friday, June 19, 2020, 10:57:59 AM EDT, Adrian Klaver <adrian.klaver@aklaver.com> wrote:
>
>
> On 6/19/20 7:52 AM, David G. Johnston wrote:
> > On Fri, Jun 19, 2020 at 6:58 AM Adrian Klaver <adrian.klaver@aklaver.com
> > <mailto:adrian.klaver@aklaver.com>> wrote:
> >
> > On 6/19/20 6:53 AM, Pepe TD Vo wrote:
> > > Thank you sir and I am sorry for the typo not having "--" on
> > password.
> > > I did spelling out with --password=mypassword
> >
> > Please go back and read my post again.
> >
> >
> > To be clear, there is no way to supply a password as a command line
> > argument. It is fundamentally a bad idea and we don't even make it an
> > option.
>
> Actually that is not entirely true, see my follow up post.
>
> >
> > You need to decide on one of the actual ways of supplying a password, or
> > choose an alternative authentication method like peer.
> >
> > David J.
>
> >
>
>
> --
> Adrian Klaver
> adrian.klaver@aklaver.com
>
>
^ permalink raw reply [nested|flat] 32+ messages in thread
* Re: create batch script to import into postgres tables
2020-06-16 14:20 create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-16 14:24 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-16 14:59 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-16 15:16 ` Re: create batch script to import into postgres tables Christopher Browne <cbbrowne@gmail.com>
2020-06-16 15:42 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-18 15:20 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-18 16:08 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-18 16:40 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-18 19:06 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-18 19:54 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-18 23:00 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-18 23:37 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-19 00:00 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-19 01:25 ` Re: create batch script to import into postgres tables cgerard999@gmail.com
2020-06-19 11:12 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-19 13:19 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-19 13:53 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-19 13:58 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-19 14:52 ` Re: create batch script to import into postgres tables David G. Johnston <david.g.johnston@gmail.com>
2020-06-19 14:57 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-19 15:07 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-19 15:30 ` Re: create batch script to import into postgres tables cgerard999@gmail.com
@ 2020-06-19 18:23 ` Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-19 19:26 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
0 siblings, 1 reply; 32+ messages in thread
From: Adrian Klaver @ 2020-06-19 18:23 UTC (permalink / raw)
To: cgerard999@gmail.com, Pepe TD Vo <pepevo@yahoo.com>; +Cc: David G. Johnston <david.g.johnston@gmail.com>; Christopher Browne <cbbrowne@gmail.com>; pgsql-admin; Pgsql-general <pgsql-general@postgresql.org>
On 6/19/20 8:30 AM, cgerard999@gmail.com wrote:
> There is an alternate solution, which is to launch pgadmin GUI, connect
> to the database, tick « save password »
> Then psql won’t prompt fir password any more.
Pretty sure that is only within the context of pgAdmin.
> Pay however attention to the security concern.
>
> Sent from my mobile phone
>
>> Le 19 juin 2020 à 17:07, Pepe TD Vo <pepevo@yahoo.com> a écrit :
>>
>>
>> appreciate for clarification, all inputs and teaching me more in
>> PostgreSQL
>>
>> have a good weekend and happy father's day to all who is Father.
>>
>> v/r,
>>
>> **
>> *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 forgive
>> more.EmojiEmojiEmoji
>> 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
>> gentleman (Hermione Gingold)
>>
>> **Live simply **Love generously **Care deeply **Speak kindly.
>> *** Genuinely rich *** Faithful talent *** Sharing success
>>
>>
>>
>>
>> On Friday, June 19, 2020, 10:57:59 AM EDT, Adrian Klaver
>> <adrian.klaver@aklaver.com> wrote:
>>
>>
>> On 6/19/20 7:52 AM, David G. Johnston wrote:
>> > On Fri, Jun 19, 2020 at 6:58 AM Adrian Klaver
>> <adrian.klaver@aklaver.com <mailto:adrian.klaver@aklaver.com>
>> > <mailto:adrian.klaver@aklaver.com
>> <mailto:adrian.klaver@aklaver.com>>> wrote:
>> >
>> > On 6/19/20 6:53 AM, Pepe TD Vo wrote:
>> > > Thank you sir and I am sorry for the typo not having "--" on
>> > password.
>> > > I did spelling out with --password=mypassword
>> >
>> > Please go back and read my post again.
>> >
>> >
>> > To be clear, there is no way to supply a password as a command line
>> > argument. It is fundamentally a bad idea and we don't even make it an
>> > option.
>>
>> Actually that is not entirely true, see my follow up post.
>>
>> >
>> > You need to decide on one of the actual ways of supplying a
>> password, or
>> > choose an alternative authentication method like peer.
>> >
>> > David J.
>>
>> >
>>
>>
>> --
>> Adrian Klaver
>> adrian.klaver@aklaver.com <mailto:adrian.klaver@aklaver.com>
>>
>>
--
Adrian Klaver
adrian.klaver@aklaver.com
^ permalink raw reply [nested|flat] 32+ messages in thread
* Re: create batch script to import into postgres tables
2020-06-16 14:20 create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-16 14:24 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-16 14:59 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-16 15:16 ` Re: create batch script to import into postgres tables Christopher Browne <cbbrowne@gmail.com>
2020-06-16 15:42 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-18 15:20 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-18 16:08 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-18 16:40 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-18 19:06 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-18 19:54 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-18 23:00 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-18 23:37 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-19 00:00 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-19 01:25 ` Re: create batch script to import into postgres tables cgerard999@gmail.com
2020-06-19 11:12 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-19 13:19 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-19 13:53 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-19 13:58 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-19 14:52 ` Re: create batch script to import into postgres tables David G. Johnston <david.g.johnston@gmail.com>
2020-06-19 14:57 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-19 15:07 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-19 15:30 ` Re: create batch script to import into postgres tables cgerard999@gmail.com
2020-06-19 18:23 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
@ 2020-06-19 19:26 ` Pepe TD Vo <pepevo@yahoo.com>
2020-06-19 19:37 ` Re: create batch script to import into postgres tables Rob Sargent <robjsargent@gmail.com>
2020-06-19 19:37 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
0 siblings, 2 replies; 32+ messages in thread
From: Pepe TD Vo @ 2020-06-19 19:26 UTC (permalink / raw)
To: cgerard999@gmail.com, Adrian Klaver <adrian.klaver@aklaver.com>; +Cc: David G. Johnston <david.g.johnston@gmail.com>; Christopher Browne <cbbrowne@gmail.com>; pgsql-admin; Pgsql-general <pgsql-general@postgresql.org>
thank you for all the information but I have no problem connecting to the database using pgAdmin and/or directly psql from the postgres database.
I need to set up a batch/cron job to run in Linux/AWS to ingest the data. Therefore pgadmin GUI is not an option. I used pgAdmin to create tables, triggers, function triggers and manual importing/exporting. You can't schedule a time to run importing from csv file(s) using pgAdmin as same OEM.
The select table in this question is just an example for me to create scripting to see it connect or not. No one at work to manually run the script and enter the password. Need to bypass it like Oracle scripting. Since this is not an option to put the password to connect to the database and run the script(s), we will find another way to do.
I am thankful for all the input.
v/r,
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 forgive more.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 gentleman (Hermione Gingold)
**Live simply **Love generously **Care deeply **Speak kindly.*** Genuinely rich *** Faithful talent *** Sharing success
On Friday, June 19, 2020, 02:24:05 PM EDT, Adrian Klaver <adrian.klaver@aklaver.com> wrote:
On 6/19/20 8:30 AM, cgerard999@gmail.com wrote:
> There is an alternate solution, which is to launch pgadmin GUI, connect
> to the database, tick « save password »
> Then psql won’t prompt fir password any more.
Pretty sure that is only within the context of pgAdmin.
> Pay however attention to the security concern.
>
> Sent from my mobile phone
>
>> Le 19 juin 2020 à 17:07, Pepe TD Vo <pepevo@yahoo.com> a écrit :
>>
>>
>> appreciate for clarification, all inputs and teaching me more in
>> PostgreSQL
>>
>> have a good weekend and happy father's day to all who is Father.
>>
>> v/r,
>>
>> **
>> *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 forgive
>> more.EmojiEmojiEmoji
>> 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
>> gentleman (Hermione Gingold)
>>
>> **Live simply **Love generously **Care deeply **Speak kindly.
>> *** Genuinely rich *** Faithful talent *** Sharing success
>>
>>
>>
>>
>> On Friday, June 19, 2020, 10:57:59 AM EDT, Adrian Klaver
>> <adrian.klaver@aklaver.com> wrote:
>>
>>
>> On 6/19/20 7:52 AM, David G. Johnston wrote:
>> > On Fri, Jun 19, 2020 at 6:58 AM Adrian Klaver
>> <adrian.klaver@aklaver.com <mailto:adrian.klaver@aklaver.com>
>> > <mailto:adrian.klaver@aklaver.com
>> <mailto:adrian.klaver@aklaver.com>>> wrote:
>> >
>> > On 6/19/20 6:53 AM, Pepe TD Vo wrote:
>> > > Thank you sir and I am sorry for the typo not having "--" on
>> > password.
>> > > I did spelling out with --password=mypassword
>> >
>> > Please go back and read my post again.
>> >
>> >
>> > To be clear, there is no way to supply a password as a command line
>> > argument. It is fundamentally a bad idea and we don't even make it an
>> > option.
>>
>> Actually that is not entirely true, see my follow up post.
>>
>> >
>> > You need to decide on one of the actual ways of supplying a
>> password, or
>> > choose an alternative authentication method like peer.
>> >
>> > David J.
>>
>> >
>>
>>
>> --
>> Adrian Klaver
>> adrian.klaver@aklaver.com <mailto:adrian.klaver@aklaver.com>
>>
>>
--
Adrian Klaver
adrian.klaver@aklaver.com
^ permalink raw reply [nested|flat] 32+ messages in thread
* Re: create batch script to import into postgres tables
2020-06-16 14:20 create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-16 14:24 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-16 14:59 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-16 15:16 ` Re: create batch script to import into postgres tables Christopher Browne <cbbrowne@gmail.com>
2020-06-16 15:42 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-18 15:20 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-18 16:08 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-18 16:40 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-18 19:06 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-18 19:54 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-18 23:00 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-18 23:37 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-19 00:00 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-19 01:25 ` Re: create batch script to import into postgres tables cgerard999@gmail.com
2020-06-19 11:12 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-19 13:19 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-19 13:53 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-19 13:58 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-19 14:52 ` Re: create batch script to import into postgres tables David G. Johnston <david.g.johnston@gmail.com>
2020-06-19 14:57 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-19 15:07 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-19 15:30 ` Re: create batch script to import into postgres tables cgerard999@gmail.com
2020-06-19 18:23 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-19 19:26 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
@ 2020-06-19 19:37 ` Rob Sargent <robjsargent@gmail.com>
1 sibling, 0 replies; 32+ messages in thread
From: Rob Sargent @ 2020-06-19 19:37 UTC (permalink / raw)
To: Pepe TD Vo <pepevo@yahoo.com>; +Cc: cgerard999@gmail.com, Adrian Klaver <adrian.klaver@aklaver.com>; David G. Johnston <david.g.johnston@gmail.com>; Christopher Browne <cbbrowne@gmail.com>; pgsql-admin; pgsql-general@postgresql.org <pgsql-general@postgresql.org>
> On Jun 19, 2020, at 1:26 PM, Pepe TD Vo <pepevo@yahoo.com> wrote:
>
> thank you for all the information but I have no problem connecting to the database using pgAdmin and/or directly psql from the postgres database.
>
> I need to set up a batch/cron job to run in Linux/AWS to ingest the data. Therefore pgadmin GUI is not an option. I used pgAdmin to create tables, triggers, function triggers and manual importing/exporting. You can't schedule a time to run importing from csv file(s) using pgAdmin as same OEM.
>
> The select table in this question is just an example for me to create scripting to see it connect or not. No one at work to manually run the script and enter the password. Need to bypass it like Oracle scripting. Since this is not an option to put the password to connect to the database and run the script(s), we will find another way to do.
>
> I am thankful for all the input.
>
> v/r,
And it has been explained upstream that one “way to do” is to use a .pgpass file for the cronjob user. And that file must be read-only to user, no access to group or other (chmod 400 $CRONUSER/.pgpass). Another is a “trust” entry for the user in pg_hba.conf. I suggest you revisit those messages.
^ permalink raw reply [nested|flat] 32+ messages in thread
* Re: create batch script to import into postgres tables
2020-06-16 14:20 create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-16 14:24 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-16 14:59 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-16 15:16 ` Re: create batch script to import into postgres tables Christopher Browne <cbbrowne@gmail.com>
2020-06-16 15:42 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-18 15:20 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-18 16:08 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-18 16:40 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-18 19:06 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-18 19:54 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-18 23:00 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-18 23:37 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-19 00:00 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-19 01:25 ` Re: create batch script to import into postgres tables cgerard999@gmail.com
2020-06-19 11:12 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-19 13:19 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-19 13:53 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-19 13:58 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-19 14:52 ` Re: create batch script to import into postgres tables David G. Johnston <david.g.johnston@gmail.com>
2020-06-19 14:57 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-19 15:07 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-19 15:30 ` Re: create batch script to import into postgres tables cgerard999@gmail.com
2020-06-19 18:23 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-19 19:26 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
@ 2020-06-19 19:37 ` Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-20 00:24 ` Re: create batch script to import into postgres tables David G. Johnston <david.g.johnston@gmail.com>
1 sibling, 1 reply; 32+ messages in thread
From: Adrian Klaver @ 2020-06-19 19:37 UTC (permalink / raw)
To: Pepe TD Vo <pepevo@yahoo.com>; cgerard999@gmail.com; +Cc: David G. Johnston <david.g.johnston@gmail.com>; Christopher Browne <cbbrowne@gmail.com>; pgsql-admin; Pgsql-general <pgsql-general@postgresql.org>
On 6/19/20 12:26 PM, Pepe TD Vo wrote:
> thank you for all the information but I have no problem connecting to
> the database using pgAdmin and/or directly psql from the postgres database.
>
> I need to set up a batch/cron job to run in Linux/AWS to ingest the
> data. Therefore pgadmin GUI is not an option. I used pgAdmin to create
> tables, triggers, function triggers and manual importing/exporting. You
> can't schedule a time to run importing from csv file(s) using pgAdmin
> as same OEM.
There is pgAgent:
https://www.pgadmin.org/docs/pgadmin4/development/pgagent.html
>
> The select table in this question is just an example for me to create
> scripting to see it connect or not. No one at work to manually run the
> script and enter the password. Need to bypass it like Oracle
> scripting. Since this is not an option to put the password to connect
> to the database and run the script(s), we will find another way to do.
But there is an option.
>
> I am thankful for all the input.
>
> v/r,
>
>
> **
> *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 forgive
> more.EmojiEmojiEmoji
> 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 gentleman
> (Hermione Gingold)
>
> **Live simply **Love generously **Care deeply **Speak kindly.
> *** Genuinely rich *** Faithful talent *** Sharing success
>
>
>
>
> On Friday, June 19, 2020, 02:24:05 PM EDT, Adrian Klaver
> <adrian.klaver@aklaver.com> wrote:
>
>
> On 6/19/20 8:30 AM, cgerard999@gmail.com <mailto:cgerard999@gmail.com>
> wrote:
> > There is an alternate solution, which is to launch pgadmin GUI, connect
> > to the database, tick « save password »
> > Then psql won’t prompt fir password any more.
>
> Pretty sure that is only within the context of pgAdmin.
>
> > Pay however attention to the security concern.
> >
> > Sent from my mobile phone
> >
> >> Le 19 juin 2020 à 17:07, Pepe TD Vo <pepevo@yahoo.com
> <mailto:pepevo@yahoo.com>> a écrit :
> >>
> >>
> >> appreciate for clarification, all inputs and teaching me more in
> >> PostgreSQL
> >>
> >> have a good weekend and happy father's day to all who is Father.
> >>
> >> v/r,
> >>
> >> **
> >> *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 forgive
> >> more.EmojiEmojiEmoji
> >> 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
> >> gentleman (Hermione Gingold)
> >>
> >> **Live simply **Love generously **Care deeply **Speak kindly.
> >> *** Genuinely rich *** Faithful talent *** Sharing success
> >>
> >>
> >>
> >>
> >> On Friday, June 19, 2020, 10:57:59 AM EDT, Adrian Klaver
> >> <adrian.klaver@aklaver.com <mailto:adrian.klaver@aklaver.com>> wrote:
> >>
> >>
> >> On 6/19/20 7:52 AM, David G. Johnston wrote:
> >> > On Fri, Jun 19, 2020 at 6:58 AM Adrian Klaver
> >> <adrian.klaver@aklaver.com <mailto:adrian.klaver@aklaver.com>
> <mailto:adrian.klaver@aklaver.com <mailto:adrian.klaver@aklaver.com>>
> >> > <mailto:adrian.klaver@aklaver.com <mailto:adrian.klaver@aklaver.com>
> >> <mailto:adrian.klaver@aklaver.com
> <mailto:adrian.klaver@aklaver.com>>>> wrote:
> >> >
> >> > On 6/19/20 6:53 AM, Pepe TD Vo wrote:
> >> > > Thank you sir and I am sorry for the typo not having "--" on
> >> > password.
> >> > > I did spelling out with --password=mypassword
> >> >
> >> > Please go back and read my post again.
> >> >
> >> >
> >> > To be clear, there is no way to supply a password as a command line
> >> > argument. It is fundamentally a bad idea and we don't even make it an
> >> > option.
> >>
> >> Actually that is not entirely true, see my follow up post.
> >>
> >> >
> >> > You need to decide on one of the actual ways of supplying a
> >> password, or
> >> > choose an alternative authentication method like peer.
> >> >
> >> > David J.
>
> >>
> >> >
> >>
> >>
> >> --
> >> Adrian Klaver
> >> adrian.klaver@aklaver.com <mailto:adrian.klaver@aklaver.com>
> <mailto:adrian.klaver@aklaver.com <mailto:adrian.klaver@aklaver.com>>
> >>
> >>
>
>
> --
> Adrian Klaver
> adrian.klaver@aklaver.com <mailto:adrian.klaver@aklaver.com>
>
>
--
Adrian Klaver
adrian.klaver@aklaver.com
^ permalink raw reply [nested|flat] 32+ messages in thread
* Re: create batch script to import into postgres tables
2020-06-16 14:20 create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-16 14:24 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-16 14:59 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-16 15:16 ` Re: create batch script to import into postgres tables Christopher Browne <cbbrowne@gmail.com>
2020-06-16 15:42 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-18 15:20 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-18 16:08 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-18 16:40 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-18 19:06 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-18 19:54 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-18 23:00 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-18 23:37 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-19 00:00 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-19 01:25 ` Re: create batch script to import into postgres tables cgerard999@gmail.com
2020-06-19 11:12 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-19 13:19 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-19 13:53 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-19 13:58 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-19 14:52 ` Re: create batch script to import into postgres tables David G. Johnston <david.g.johnston@gmail.com>
2020-06-19 14:57 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-19 15:07 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-19 15:30 ` Re: create batch script to import into postgres tables cgerard999@gmail.com
2020-06-19 18:23 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-19 19:26 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-19 19:37 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
@ 2020-06-20 00:24 ` David G. Johnston <david.g.johnston@gmail.com>
2020-06-20 01:38 ` Re: create batch script to import into postgres tables David G. Johnston <david.g.johnston@gmail.com>
0 siblings, 1 reply; 32+ messages in thread
From: David G. Johnston @ 2020-06-20 00:24 UTC (permalink / raw)
To: pepevo <pepevo@yahoo.com>; +Cc: Adrian Klaver <adrian.klaver@aklaver.com>; cgerard999@gmail.com <cgerard999@gmail.com>; Christopher Browne <cbbrowne@gmail.com>; pgsql-admin; Pgsql-general <pgsql-general@postgresql.org>
On Friday, June 19, 2020, pepevo <pepevo@yahoo.com> wrote:
> We can't just install any softwares without Goverment's approval. Also,
> they might ask Oracle/mysql/sql can run batch script, why not Postgres? I
> wonder myself and just realize today from this email.
>
PostreSQL isn’t the issue here, you are. To the extent that others
attempting to help you over email are insufficient is a failing driven
mainly by the medium of choice probably being an inefficient medium for the
student. What you want to do is possible but it requires understanding
multiple applications. You are better off getting closer to your goal by
reading books and articles about those applications and then asking better
questions. Or at minimum being more detailed in stating your goal and
requirements.
David J.
^ permalink raw reply [nested|flat] 32+ messages in thread
* Re: create batch script to import into postgres tables
2020-06-16 14:20 create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-16 14:24 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-16 14:59 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-16 15:16 ` Re: create batch script to import into postgres tables Christopher Browne <cbbrowne@gmail.com>
2020-06-16 15:42 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-18 15:20 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-18 16:08 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-18 16:40 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-18 19:06 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-18 19:54 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-18 23:00 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-18 23:37 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-19 00:00 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-19 01:25 ` Re: create batch script to import into postgres tables cgerard999@gmail.com
2020-06-19 11:12 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-19 13:19 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-19 13:53 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-19 13:58 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-19 14:52 ` Re: create batch script to import into postgres tables David G. Johnston <david.g.johnston@gmail.com>
2020-06-19 14:57 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-19 15:07 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-19 15:30 ` Re: create batch script to import into postgres tables cgerard999@gmail.com
2020-06-19 18:23 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-19 19:26 ` Re: create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-19 19:37 ` Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-20 00:24 ` Re: create batch script to import into postgres tables David G. Johnston <david.g.johnston@gmail.com>
@ 2020-06-20 01:38 ` David G. Johnston <david.g.johnston@gmail.com>
0 siblings, 0 replies; 32+ messages in thread
From: David G. Johnston @ 2020-06-20 01:38 UTC (permalink / raw)
To: pepevo <pepevo@yahoo.com>; +Cc: Adrian Klaver <adrian.klaver@aklaver.com>; cgerard999@gmail.com <cgerard999@gmail.com>; Christopher Browne <cbbrowne@gmail.com>; pgsql-admin; Pgsql-general <pgsql-general@postgresql.org>
On Friday, June 19, 2020, pepevo <pepevo@yahoo.com> wrote:
> But everything can run by script on the server, right?
>
Separation of concerns. The server with the database cluster should
probably not be running application code. Application code can be run
other machine, “admin” machine is one label. Though for development it
shouldn’t matter so long as the application is configurable. Configure it
for local during development and when in production it pulls production
configuration.
David J.
^ permalink raw reply [nested|flat] 32+ messages in thread
* Re: create batch script to import into postgres tables
@ 2020-06-19 14:33 Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-19 14:57 ` Re: create batch script to import into postgres tables David G. Johnston <david.g.johnston@gmail.com>
0 siblings, 1 reply; 32+ messages in thread
From: Adrian Klaver @ 2020-06-19 14:33 UTC (permalink / raw)
To: pepevo <pepevo@yahoo.com>; cgerard999@gmail.com; +Cc: Christopher Browne <cbbrowne@gmail.com>; pgsql-admin; Pgsql-general <pgsql-general@postgresql.org>
On 6/19/20 7:17 AM, pepevo wrote:
> I understand your post about "password does not take an argument, it is
> meant to be used as is. The purpose is to force a password prompt." When
> I used -W and --password=. That's what I said I will try pgpassfile.
> Thought it like mysq/oracle can indicate out without creating password
> file.
If you want to expose your password in the script file then:
https://www.postgresql.org/docs/12/app-psql.html
Usage
Connecting to a Database
"An alternative way to specify connection parameters is in a conninfo
string or a URI, which is used instead of a database name. This
mechanism give you very wide control over the connection. For example:
$ psql "service=myservice sslmode=require"
$ psql postgresql://dbmaster:5433/mydb?sslmode=require
This way you can also use LDAP for connection parameter lookup as
described in Section 33.17. See Section 33.1.2 for more information on
all the available connection options."
So:
psql
postgresql://PSmasteruser:mypassword@hostname.amazonaws.com:5432/PSCIDR
or
psql 'dbname=PSCIDR user=PSmasteruser host=hostname.amazonaws.com port=
5432 password=mypassword '
>
> Thank you again.
>
> Bach-Nga
>
> Sent from my Metro By T-Mobile 4G LTE Android Device
>
>
> -------- Original message --------
> From: Adrian Klaver <adrian.klaver@aklaver.com>
> Date: 6/19/20 09:58 (GMT-05:00)
> To: Pepe TD Vo <pepevo@yahoo.com>, cgerard999@gmail.com
> Cc: Christopher Browne <cbbrowne@gmail.com>, Pgsql-admin
> <pgsql-admin@postgresql.org>, Pgsql-general <pgsql-general@postgresql.org>
> Subject: Re: create batch script to import into postgres tables
>
> On 6/19/20 6:53 AM, Pepe TD Vo wrote:
> > Thank you sir and I am sorry for the typo not having "--" on password.
> > I did spelling out with --password=mypassword
>
> Please go back and read my post again.
>
> >
> >>> echo select count(*) from tableA; | "C:\Program
> > Files\PostgreSQL\11\bin\psql" -U PSmasteruser -d PSCIDR -h
> > hostname.amazonaws.com -p 5432 --password=mypassword
> >
> > even -W for password
> >>> echo select count(*) from tableA; | "C:\Program
> > Files\PostgreSQL\11\bin\psql" -U PSmasteruser -d PSCIDR -h
> > hostname.amazonaws.com -p 5432 -W=mypassword
> >
> > none of them work, still prompt me for password to type in. I will look
> > into the pgpassfile which I know it will fail again.
> >
> >
> > very respectfully,
> >
> > **
> > *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 forgive
> > more.EmojiEmojiEmoji
> > 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 gentleman
> > (Hermione Gingold)
> >
> > **Live simply **Love generously **Care deeply **Speak kindly.
> > *** Genuinely rich *** Faithful talent *** Sharing success
> >
> >
> >
> >
> > On Friday, June 19, 2020, 09:19:35 AM EDT, Adrian Klaver
> > <adrian.klaver@aklaver.com> wrote:
> >
> >
> > On 6/19/20 4:12 AM, Pepe TD Vo wrote:
> > > thank you, I tried that too, remove the quote around the echo and it
> > > prompt for password, as I mentioned no matter I put -P mypassword no
> > > matter what I spell out password=mypassword still argument error
> >
> > Once again -P has nothing to do with password. Also --password does not
> > take an argument, it is meant to be used as is. The purpose is to force
> > a password prompt. This is all spelled out here:
> >
> > https://www.postgresql.org/docs/12/app-psql.html
> >
> > Also spelled out in above is:
> >
> > " It is also convenient to have a ~/.pgpass file to avoid regularly
> > having to type in passwords. See Section 33.15 for more information."
> >
> > And Section 33.15:
> >
> > https://www.postgresql.org/docs/12/libpq-pgpass.html
> >
> > "The file .pgpass in a user's home directory can contain passwords to be
> > used if the connection requires a password (and no password has been
> > specified otherwise). ..."
> >
> > Read more at link for how to do that.
> >
> >
> > >
> > > >>echo select count(*) from tableA; | "C:\Program
> > > Files\PostgreSQL\11\bin\psql" -U PSmasteruser -d PSCIDR -h
> > > hostname.amazonaws.com -p 5432
> > >
> > > >> echo select count(*) from tableA; | "C:\Program
> > > Files\PostgreSQL\11\bin\psql" -U PSmasteruser -d PSCIDR -h
> > > hostname.amazonaws.com -p 5432 password=mypassword
> > >
> > > all usernames are same password.
> > >
> > > thank you so much for all input.
> > >
> > > v/r,
> > >
> > > **
> > > *Bach-Nga
> >
> > --
> > Adrian Klaver
> > adrian.klaver@aklaver.com <mailto:adrian.klaver@aklaver.com>
> >
> >
>
>
> --
> Adrian Klaver
> adrian.klaver@aklaver.com
>
>
--
Adrian Klaver
adrian.klaver@aklaver.com
^ permalink raw reply [nested|flat] 32+ messages in thread
* Re: create batch script to import into postgres tables
2020-06-19 14:33 Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
@ 2020-06-19 14:57 ` David G. Johnston <david.g.johnston@gmail.com>
0 siblings, 0 replies; 32+ messages in thread
From: David G. Johnston @ 2020-06-19 14:57 UTC (permalink / raw)
To: Adrian Klaver <adrian.klaver@aklaver.com>; +Cc: pepevo <pepevo@yahoo.com>; cgerard999@gmail.com, Christopher Browne <cbbrowne@gmail.com>; pgsql-admin; Pgsql-general <pgsql-general@postgresql.org>
On Fri, Jun 19, 2020 at 7:33 AM Adrian Klaver <adrian.klaver@aklaver.com>
wrote:
> On 6/19/20 7:17 AM, pepevo wrote:
> > I understand your post about "password does not take an argument, it is
> > meant to be used as is. The purpose is to force a password prompt." When
> > I used -W and --password=. That's what I said I will try pgpassfile.
> > Thought it like mysq/oracle can indicate out without creating password
> > file.
>
> If you want to expose your password in the script file then:
>
> https://www.postgresql.org/docs/12/app-psql.html
>
> Usage
> Connecting to a Database
>
> "An alternative way to specify connection parameters is in a conninfo
> string or a URI, which is used instead of a database name. This
> mechanism give you very wide control over the connection. For example:
>
> $ psql "service=myservice sslmode=require"
> $ psql postgresql://dbmaster:5433/mydb?sslmode=require
>
> This way you can also use LDAP for connection parameter lookup as
> described in Section 33.17. See Section 33.1.2 for more information on
> all the available connection options."
>
> So:
>
> psql
> postgresql://PSmasteruser:mypassword@hostname.amazonaws.com:5432/PSCIDR
>
> or
>
> psql 'dbname=PSCIDR user=PSmasteruser host=hostname.amazonaws.com port=
> 5432 password=mypassword '
>
>
Ok, so not "no way", but it's still a bad idea given the availability of
other better options. Namely PGPASSWORD, .pgpass, or, less
desirably.pg_service.conf
The URI format that includes a password should be reserved for client
libraries and avoided when using psql (just the password part really though
I much prefer the service file option myself).
David J.
^ permalink raw reply [nested|flat] 32+ messages in thread
* Re: create batch script to import into postgres tables
@ 2020-06-20 04:10 Adrian Klaver <adrian.klaver@aklaver.com>
0 siblings, 0 replies; 32+ messages in thread
From: Adrian Klaver @ 2020-06-20 04:10 UTC (permalink / raw)
To: pepevo <pepevo@yahoo.com>; David G. Johnston <david.g.johnston@gmail.com>; +Cc: cgerard999@gmail.com <cgerard999@gmail.com>; Christopher Browne <cbbrowne@gmail.com>; pgsql-admin; Pgsql-general <pgsql-general@postgresql.org>
On 6/19/20 6:28 PM, pepevo wrote:
> Yes, and I am thank you for all your helps. As I said and if you
> contract for Govt you should know, we can't just install the software
> without their approval. When someone suggested psql client to run
> batch script when I can't putty into the AWS instance. I need to asked
> lead to approval to download even I don't have administrative
> privileges and because it's on Dev and it's on our server. Real work
> will be on Linux production and everything need to be approved by
> Government. But everything can run by script on the server, right?
Alright now I am thoroughly confused. You where asking how to connect
from a Windows using psql to run a batch script from Windows machine. No
mention of any government restrictions, or approval to download. Also,
now you say you will be working on Linux machine and the script will run
on server. So basically your original question has nothing to do with
reality. Correct me if I am wrong.
> Also, I will take a look on pgpass per Adrian's suggestion when I am
> back onsite. I am still learning Postgres here and have limited on the
> server.
>
> I appreciated for all the helps here.
>
> Bach-Nga
>
> Sent from my Metro By T-Mobile 4G LTE Android Device
>
>
> -------- Original message --------
> From: "David G. Johnston" <david.g.johnston@gmail.com>
> Date: 6/19/20 20:24 (GMT-05:00)
> To: pepevo <pepevo@yahoo.com>
> Cc: Adrian Klaver <adrian.klaver@aklaver.com>, cgerard999@gmail.com,
> Christopher Browne <cbbrowne@gmail.com>, Pgsql-admin
> <pgsql-admin@postgresql.org>, Pgsql-general <pgsql-general@postgresql.org>
> Subject: Re: create batch script to import into postgres tables
>
> On Friday, June 19, 2020, pepevo <pepevo@yahoo.com
> <mailto:pepevo@yahoo.com>> wrote:
>
> We can't just install any softwares without Goverment's approval.
> Also, they might ask Oracle/mysql/sql can run batch script, why not
> Postgres? I wonder myself and just realize today from this email.
>
>
> PostreSQL isn’t the issue here, you are. To the extent that others
> attempting to help you over email are insufficient is a failing driven
> mainly by the medium of choice probably being an inefficient medium for
> the student. What you want to do is possible but it requires
> understanding multiple applications. You are better off getting closer
> to your goal by reading books and articles about those applications and
> then asking better questions. Or at minimum being more detailed in
> stating your goal and requirements.
>
> David J.
>
--
Adrian Klaver
adrian.klaver@aklaver.com
^ permalink raw reply [nested|flat] 32+ messages in thread
end of thread, other threads:[~2020-06-20 04:10 UTC | newest]
Thread overview: 32+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-06-16 14:20 create batch script to import into postgres tables Pepe TD Vo <pepevo@yahoo.com>
2020-06-16 14:24 ` Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-16 14:59 ` Pepe TD Vo <pepevo@yahoo.com>
2020-06-16 15:11 ` Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-16 15:16 ` Christopher Browne <cbbrowne@gmail.com>
2020-06-16 15:42 ` Pepe TD Vo <pepevo@yahoo.com>
2020-06-18 15:20 ` Pepe TD Vo <pepevo@yahoo.com>
2020-06-18 16:08 ` Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-18 16:40 ` Pepe TD Vo <pepevo@yahoo.com>
2020-06-18 19:06 ` Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-18 19:54 ` Pepe TD Vo <pepevo@yahoo.com>
2020-06-18 23:00 ` Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-18 23:37 ` Pepe TD Vo <pepevo@yahoo.com>
2020-06-19 00:00 ` Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-19 01:25 ` cgerard999@gmail.com
2020-06-19 11:12 ` Pepe TD Vo <pepevo@yahoo.com>
2020-06-19 13:19 ` Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-19 13:53 ` Pepe TD Vo <pepevo@yahoo.com>
2020-06-19 13:58 ` Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-19 14:52 ` David G. Johnston <david.g.johnston@gmail.com>
2020-06-19 14:57 ` Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-19 15:07 ` Pepe TD Vo <pepevo@yahoo.com>
2020-06-19 15:30 ` cgerard999@gmail.com
2020-06-19 18:23 ` Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-19 19:26 ` Pepe TD Vo <pepevo@yahoo.com>
2020-06-19 19:37 ` Rob Sargent <robjsargent@gmail.com>
2020-06-19 19:37 ` Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-20 00:24 ` David G. Johnston <david.g.johnston@gmail.com>
2020-06-20 01:38 ` David G. Johnston <david.g.johnston@gmail.com>
2020-06-19 14:33 Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
2020-06-19 14:57 ` David G. Johnston <david.g.johnston@gmail.com>
2020-06-20 04:10 Re: create batch script to import into postgres tables Adrian Klaver <adrian.klaver@aklaver.com>
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