Skip to main content
Question

Hi, I'm new to FME. I need to query an SQL database to read records based on query with multiple joins and then write to CSV after some processing. Is a Reader the best for this or Can I use SQL creator to extract the records. Which is better option.

  • September 29, 2020
  • 3 replies
  • 109 views

I'd like to get more information on when the SQL Creator can be used.

3 replies

deanhowell
Influencer
Forum|alt.badge.img+23
  • Influencer
  • September 29, 2020

Hello @nisa​ , it will depend at which phase of the process you want to read the information in.

In the image below, I have used the featurereader as I put together the where clause based on other actions in the workbench.

 

featurereader

I have found this approach very useful but have used the SQL Creator useful when just needing to read something from the database and stored for later use.

 

http://docs.safe.com/fme/html/FME_Desktop_Documentation/FME_Transformers/Transformers/sqlcreator.htm


  • Author
  • September 29, 2020
deanhowell wrote:

Hello @nisa​ , it will depend at which phase of the process you want to read the information in.

In the image below, I have used the featurereader as I put together the where clause based on other actions in the workbench.

 

featurereader

I have found this approach very useful but have used the SQL Creator useful when just needing to read something from the database and stored for later use.

 

http://docs.safe.com/fme/html/FME_Desktop_Documentation/FME_Transformers/Transformers/sqlcreator.htm

Thanks @deanhowell​  As I understand with Feature Reader cannot perform table joins as in SQL. My workbench first queries an SQL Azure database using complex join and then uses the features generated for further processing. I'd like to confirm that the SQL Creator can do this.


jkr_wrk
Influencer
Forum|alt.badge.img+28
  • September 29, 2020
nisa wrote:

Thanks @deanhowell​  As I understand with Feature Reader cannot perform table joins as in SQL. My workbench first queries an SQL Azure database using complex join and then uses the features generated for further processing. I'd like to confirm that the SQL Creator can do this.  

You can use the SQLExecutor to preform SQL statements and receive the resulting rows as Features. I have used this a lot on a Postgres database with multiple joins and spatial selectors.

 

In this case I don't receive any features but let the database do all the work:

UPDATE maintable p SET owner = r.owner   FROM zones r WHERE owner IS NULL AND ST_CONTAINS(r.geom,ST_PointOnSurface(p.geom));

Also a SQLCreator can do this. In my opinion an SQLCreator is a Creator + SQLExecuter.

 

I don't have experience with SQL Azure databases yet but expect no issues here.

 


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