On 06/10/2011 07:27, kungphil wrote:
Hello I am trying to run r.what to populate a table in PostgreSQL using;echo 'select x, y from xy limit 10' | db.select -c fs=' ' | r.what input=layer fs=',' | ... This bit works OK (I do get an extra blank column - see below) 140.877,-33.9604,,4071 140.88,-33.9604,,3670 140.882,-33.9604,,3967 140.884,-33.9604,,4630 140.887,-33.9604,,4932 140.889,-33.9604,,5090 140.891,-33.9604,,4593 140.894,-33.9604,,4678 140.896,-33.9604,,4561 140.898,-33.9604,,4561 I would then like to pipe/copy/append this to another table in PostgreSQL. I have tried using db.copy and db.out.ogr but none seem to work. I don't know of any way to bulk insert values into a PostgreSQL table, other than regular SQL INSERT commands or a COPY. I think the best would be to dump your results into a temporary CSV text file, then run a psql COPY command to upload the file to your PostgreSQL table. To stay with GRASS commands, you could pipe INSERT commands to db.execute, but that would still require an intermediate file with the x,y,val columns. Then you would need read that intermediate file, loop thru the rows and set up an SQL INSERT for each row. HTH, Micha Any help would be great! Regards, Phil -- View this message in context: http://osgeo-org.1803224.n2.nabble.com/Piping-a-table-to-PostgreSQL-tp6864910p6864910.html Sent from the Grass - Users mailing list archive at Nabble.com. _______________________________________________ grass-user mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/grass-user This mail was received via Mail-SeCure System.
|
_______________________________________________ grass-user mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/grass-user
