Skip to main content
Question

SQLCreator as Reader

  • October 14, 2014
  • 7 replies
  • 122 views

Hi all,

 

 

I used views in SQL Server Spatial as source dataset/format in FME. Inside the views I created geometry column. Now, I need to make Stored Procedure instead of view.

 

My question is: What are differences by using SQLCreator as "Reader" instead of real Reader? What about performance and so on? Is there some better solution or?

7 replies

david_r
Evangelist
  • October 14, 2014
Hi,

 

 

the SQLCreator is useful when you need to access data in an SQL enabled database using e.g. compound statements, without having to create views. The SQLCreator, does, however, not support all spatial formats, notably no support for ESRI Geodatabase. The SQLCreator is also useful to explicitely CAST certain data types into something that FME supports. An example would be Oracle RAW columns that can be cast into text this way.

 

 

For performance, it is my experience that nothing beats testing with your own data and your own formats.

 

 

David

  • Author
  • October 14, 2014
Hi David,

 

 

I need SQLCreator explicitly for MS SQL Server to work with stored procedures. But, he doesn't "see" geometry I created in SP. This is probably one of unsupported formats.

 

 

Thank you!

david_r
Evangelist
  • October 14, 2014
Hi,

 

 

consider casting the geometry to WKB (http://technet.microsoft.com/en-us/library/bb933881(v=sql.105).aspx) in the stored procedure (or in the SQLCreator). You can then reconstruct the geometry in FME using a GeometryReplacer on the WKB blob.

 

 

I do this all the time to work around the limitation in the SQLCreator and SDE tables, works really well.

 

 

David

  • Author
  • October 14, 2014
Thank you :)

helmoet
Forum|alt.badge.img+8
  • April 26, 2019
david_r wrote:
Hi,

 

 

consider casting the geometry to WKB (http://technet.microsoft.com/en-us/library/bb933881(v=sql.105).aspx) in the stored procedure (or in the SQLCreator). You can then reconstruct the geometry in FME using a GeometryReplacer on the WKB blob.

 

 

I do this all the time to work around the limitation in the SQLCreator and SDE tables, works really well.

 

 

David

Super tip, this .STAsBinary() , David! Remember to use a non-spatial format in this case. Though, still "Microsoft SQL Server Spatial Reader: Query failed, possibly due to a malformed statement " when using SQLCreator on MSSQL (FME 2017).


david_r
Evangelist
  • April 26, 2019
helmoet wrote:

Super tip, this .STAsBinary() , David! Remember to use a non-spatial format in this case. Though, still "Microsoft SQL Server Spatial Reader: Query failed, possibly due to a malformed statement " when using SQLCreator on MSSQL (FME 2017).

You're right, thanks for the heads up!


Forum|alt.badge.img
  • April 26, 2019

Another consideration: Readers and Writers cannot be used inside custom transformers, but transformers that read and/or write (SQLCreator, SQLExecutor, FeatureReader, FeatureWriter) can be used inside custom transformers.

This is a big distinction if you are trying to increase the performance of your translation using parallel processing. If your stored procedure is parameterized so that it only returns a partition of the source data, in certain situations you can completely isolate the extraction, transformation, and loading of independent partitions inside independent fmeworker processes.


Reply


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