Skip to main content
Question

PostgreSQL Scirpt (.SQL)

  • November 13, 2012
  • 2 replies
  • 13 views

Instead of directly writing in it, is there any way to write an SQL script to run at an appropriate time while using PostgreSQL reader/writer?

2 replies

You could use a SQLExecutor on a PostGIS database (with the script embeded as a transformer parameter), but that would not be tied to your writer, and I'm not sure if that would work for a non-PostGIS PostgreSQL database.

  • November 14, 2012
I do this all the time using a text writer (e.g. CSV) with a single column.  You have to build the SQL by hand by concatenating strings/variables in an attribute creator.  For example:

 

INSERT INTO $(DestFeature2) VALUES (DEFAULT,'@Value(LOCALITY_ID)','@Value(INPUT_STRING)','@Value(CONFIDENCE)');

 

 

The output is just a block of SQL statements in a text file which you can then pipe to psql at your leisure.

Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings