Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

[resolved] How to insert row in PostgreSQL using ST_GeographyFromText - Postgis?

Hi all, 
I have a job like two pictures below.
I have :
+ input: excel file (id, longitude, latitude)
+ output: postgresql's table (id , location ) and data type of " location"column is " geometry"
When inserting new record  I have to call function " ST_GeographyFromText" in database ( ex: INSERT INTO out_put_table VALUES (1,ST_GeographyFromText('POINT(106.667010 10.776100)')::geometry);  )
My question: can I call function "ST_GeographyFromText" in tmap (when mapping data) ? if not, could you give me several solutions ?
I reviewed: tPostgresqlSP, tPostgresqlRow component (but I think It can not use in this scenario)
Many thanks.

0683p000009MB92.png 0683p000009MB6I.png
Labels (2)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

I resolved by using tPostgresqlRow (do not use tMap) 
t_connection   ------(subjob ok)------ t_excel_input  ------(main)------ t_PostgresqlRow  ------(subjob ok)------ t_PostgresqlCommit
t_PostgressqlRow query (basic setting) : "insert into out_put_value (id, location) values (" + row1.id + "," + "ST_GeographyFromText(" + " ' " + "POINT(" + row1.longitude + " " + row1.latitude + ")" + " ' " + ")::geometry" + " ) ;"
 Thanks for reading.

View solution in original post

3 Replies
Anonymous
Not applicable
Author

I resolved by using tPostgresqlRow (do not use tMap) 
t_connection   ------(subjob ok)------ t_excel_input  ------(main)------ t_PostgresqlRow  ------(subjob ok)------ t_PostgresqlCommit
t_PostgressqlRow query (basic setting) : "insert into out_put_value (id, location) values (" + row1.id + "," + "ST_GeographyFromText(" + " ' " + "POINT(" + row1.longitude + " " + row1.latitude + ")" + " ' " + ")::geometry" + " ) ;"
 Thanks for reading.
_AnonymousUser
Specialist III
Specialist III

hi mrjody,
are you tested you solution ? how  t_PostgressqlRow   can know row1.id?
Tanks.
Anonymous
Not applicable
Author

@nono1: yes, of course I tested.
t_excel_input component: it is refered to an excel file with three columns (id, longitude, latitude)
"How t_PostgresqlRow can know row1.id?" --> it depend on Talend mechanism.
You can read from: 
1/  link 1
2/  link 2
Regard.