Skip to main content
Question

PostgreSQL Scirpt (.SQL)

  • November 13, 2012
  • 2 replies
  • 26 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?
This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

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.

graeme
Contributor
Forum|alt.badge.img+4
  • Contributor
  • 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.