dbTalk Databases Forums  

data copy script

comp.databases.postgresql.novice comp.databases.postgresql.novice


Discuss data copy script in the comp.databases.postgresql.novice forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Keith Worthington
 
Posts: n/a

Default data copy script - 10-12-2004 , 02:36 PM






Hi All,

I need to write a shell script that can be run by cron to automatically load
data into a PostgreSQL database. I have been experimenting with the copy
command in psql and I have a few questions.

How can I run a copy command from a script?
What is the usage for the copy command when getting data from stdin?

Kind Regards,
Keith

______________________________________________
99main Internet Services http://www.99main.com


---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo (AT) postgresql (DOT) org so that your
message can get through to the mailing list cleanly


Reply With Quote
  #2  
Old   
Ron St-Pierre
 
Posts: n/a

Default Re: data copy script - 10-12-2004 , 03:21 PM






Keith Worthington wrote:

Quote:
Hi All,

I need to write a shell script that can be run by cron to automatically load
data into a PostgreSQL database. I have been experimenting with the copy
command in psql and I have a few questions.

How can I run a copy command from a script?

You can either run the command directly from postgres' cron:
0 22 * * * /usr/local/pgsql/bin/pgsql -p
5432 -d imperial -c" COPY dataTable FROM 'fileName' WITH NULL AS '';"
or place the script inside of a file and have cron call it using
something like:
0 22 * * * sh
/usr/local/pgsql/myShellScript.sh

Ron

Quote:
What is the usage for the copy command when getting data from stdin?

Kind Regards,
Keith

______________________________________________
99main Internet Services http://www.99main.com


---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo (AT) postgresql (DOT) org so that your
message can get through to the mailing list cleanly






---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.