Skip to main content
Question

Hi, I have a non spatial SQL command that I want to use in FME. Is there a way to plug it in without 1. making it a view in SSMS, or 2. without using a sql executor transformer?

  • August 30, 2023
  • 5 replies
  • 52 views

I tried pasting my SQL command in the feature reader, but it keeps bringing in everything from that database or schema.

5 replies

boydfme
Contributor
Forum|alt.badge.img+10
  • Contributor
  • August 30, 2023

In a reader you can use the where box to limit the features you want by a where SQL statement:

Reader where clause statementFor example, if I had a SQL ArcSDE I could go something like this in my reader:

##Example of nonspatial query; query by attributes on road_ln (feature class)
##Give me features where the field PLAN_AUTH is equal to Organization value or where my PLAN_ROUTE_DSGNTN is equal to ORG Road.
 
where "PLAN_AUTH"='Organization' OR "PLAN_ROUTE_DSGNTN"='ORG Road'

What is the SQL statement you are trying to execute? 

 

*Note: If you are using a featureReader it is sometimes helpful to use the option: single output and then use the <generic> output and bring in the attributes you need via an attribute exposer after the fact.


  • Author
  • August 31, 2023

My command is more complicated than that, so this will not work. However, I am now able to do it using SQLCreator instead.


itsmatt
Celebrity
Forum|alt.badge.img+47
  • Celebrity
  • August 31, 2023

Just curious why you didn't want to use the SQLExecutor for this?


  • Author
  • August 31, 2023

SQL Executor requires a reader where by SQLCreator does not. With SQLCreator, I can use plug my whole command in and it will run. At least this is how I understood it.


itsmatt
Celebrity
Forum|alt.badge.img+47
  • Celebrity
  • September 1, 2023

SQL Executor requires a reader where by SQLCreator does not. With SQLCreator, I can use plug my whole command in and it will run. At least this is how I understood it.

Ah right - You can also start a workspace with a Creator transformer. an SQLCreator is similar to having a Creator > SQLExcecutor.

 

The Creator is a very helpful transformer.