Skip to main content
Question

Run SQL procedure after loading shapefile

  • December 5, 2012
  • 3 replies
  • 34 views

Hi, I have a reader and writer to load and re-project a shapefile into MS SQL Spatial 2008 R2.  All good.  Now I want to run an existing stored procedure once after the file loads correctly.  The stored proc has no parameters.  Help greatly appreciated.

 

FME Desktop 2012 SP3

3 replies

Forum|alt.badge.img+4
  • December 6, 2012
There are a few transformers that can execute on-the-fly SQL statements for example, check out the SQLExecutor and FeatureReader. However, these would be executed as the shape file is being uploaded to SQL Server. 

 

 

For things to be performed AFTER a FME process has finished, I'd recommend the usage of either a Python Shutdown Script (check the Advanced Workspace parameters in the Navigator section) or a batch script which first executes the FME workbench and afterwards executes the stored proc.

 

 

If your stored procedure isn't SQL based and is rather a macro defined only in SQL Server that neither FME or command prompt can access, you may need to look at a more programmatic approach based around SQL Server itself rather than FME.

sigtill
Supporter
Forum|alt.badge.img+24
  • Supporter
  • December 6, 2012
Trying to use only FME I usually use either a python-script (with MSSQL libraries for python installed) or more preferred a second workspace and a WorkspaceRunner. This way I have more controll over the situation when it sometimes fails.

erik_jan
Contributor
Forum|alt.badge.img+18
  • Contributor
  • December 6, 2012
Hi,

 

 

I would use a WorkSpaceRunner to load the Shape file and attach a SQLExecutor at the SUCCEDED port of the WorkSpaceRunner.

 

This way the SQL will be executed only if the loading succeeds.

 

The WorkSpaceRunner can be triggered by using a Creator (once) of a FilePathReader for every Shape file in a directory.

 

 

Kind regards,

 

Erik Jan Bodewitz

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