i want to right the shell script which talk to my postgresql database
Hi
I am new to this . i want to right the on linux box which have postgresql and i what some data from the different table and put it in .csv file. dhiren |
Google for something like "access postgres with shell script". Dont forget the quotes (").
|
I believe you can do something like the following to output a csv file (<database> is the name of your database):
Code:
psql -A -q -t -F, -d <database> -o database.csv -c 'select * from table' Have a look at the man page for pg_dump and find the '-T' option. Here is an example: (<tablename> is the name of the table ... <database> is the name of the database): Code:
pg_dump -T '<tablename>' <database> > mydb_table.sql |
All times are GMT -5. The time now is 04:59 AM. |