Re: create batch script to import into postgres tables

2020-07-08 Thread Shaozhong SHI
I am happy to help with testing the bash script and producing a documentation. Regards, Shao On Sat, 20 Jun 2020 at 02:38, David G. Johnston wrote: > On Friday, June 19, 2020, pepevo wrote: > >> But everything can run by script on the server, right? >> > > Separation of concerns. The server

Re: create batch script to import into postgres tables

2020-06-19 Thread Adrian Klaver
from my Metro By T-Mobile 4G LTE Android Device Original message From: "David G. Johnston" Date: 6/19/20 20:24 (GMT-05:00) To: pepevo Cc: Adrian Klaver , cgerard...@gmail.com, Christopher Browne , Pgsql-admin , Pgsql-general Subject: Re: create batch script

Re: create batch script to import into postgres tables

2020-06-19 Thread David G. Johnston
On Friday, June 19, 2020, pepevo 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

Re: create batch script to import into postgres tables

2020-06-19 Thread David G. Johnston
On Friday, June 19, 2020, pepevo 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

Re: create batch script to import into postgres tables

2020-06-19 Thread Adrian Klaver
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

Re: create batch script to import into postgres tables

2020-06-19 Thread Rob Sargent
> On Jun 19, 2020, at 1: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

Re: create batch script to import into postgres tables

2020-06-19 Thread Pepe TD Vo
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,

Re: create batch script to import into postgres tables

2020-06-19 Thread Adrian Klaver
On 6/19/20 8:30 AM, cgerard...@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

Re: create batch script to import into postgres tables

2020-06-19 Thread cgerard999
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 a écrit : > >  >

Re: create batch script to import into postgres tables

2020-06-19 Thread Pepe TD Vo
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

Re: create batch script to import into postgres tables

2020-06-19 Thread David G. Johnston
On Fri, Jun 19, 2020 at 7:33 AM Adrian Klaver 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

Re: create batch script to import into postgres tables

2020-06-19 Thread Adrian Klaver
On 6/19/20 7:52 AM, David G. Johnston wrote: On Fri, Jun 19, 2020 at 6:58 AM Adrian Klaver > 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

Re: create batch script to import into postgres tables

2020-06-19 Thread David G. Johnston
On Fri, Jun 19, 2020 at 6:58 AM Adrian Klaver 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

Re: create batch script to import into postgres tables

2020-06-19 Thread Adrian Klaver
ou again. Bach-Nga Sent from my Metro By T-Mobile 4G LTE Android Device Original message From: Adrian Klaver Date: 6/19/20 09:58 (GMT-05:00) To: Pepe TD Vo , cgerard...@gmail.com Cc: Christopher Browne , Pgsql-admin , Pgsql-general Subject: Re: create batch script to import

Re: create batch script to import into postgres tables

2020-06-19 Thread Adrian Klaver
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

Re: create batch script to import into postgres tables

2020-06-19 Thread Pepe TD Vo
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

Re: create batch script to import into postgres tables

2020-06-19 Thread Adrian Klaver
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.

Re: create batch script to import into postgres tables

2020-06-19 Thread Pepe TD Vo
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

Re: create batch script to import into postgres tables

2020-06-18 Thread cgerard999
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 a écrit : > > On 6/18/20

Re: create batch script to import into postgres tables

2020-06-18 Thread Adrian Klaver
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

Re: create batch script to import into postgres tables

2020-06-18 Thread Pepe TD Vo
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

Re: create batch script to import into postgres tables

2020-06-18 Thread Adrian Klaver
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

Re: create batch script to import into postgres tables

2020-06-18 Thread Pepe TD Vo
>>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 

Re: create batch script to import into postgres tables

2020-06-18 Thread Adrian Klaver
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,

Re: create batch script to import into postgres tables

2020-06-18 Thread Pepe TD Vo
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

Re: create batch script to import into postgres tables

2020-06-18 Thread Adrian Klaver
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?

Re: create batch script to import into postgres tables

2020-06-18 Thread Pepe TD Vo
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

Re: create batch script to import into postgres tables

2020-06-16 Thread Adrian Klaver
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

Re: create batch script to import into postgres tables

2020-06-16 Thread Pepe TD Vo
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

Re: create batch script to import into postgres tables

2020-06-16 Thread Adrian Klaver
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

create batch script to import into postgres tables

2020-06-16 Thread Pepe TD Vo
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