Skip to main content
Solved

How to export a workbench transformation to Python?


rudystricklan1
Contributor
Forum|alt.badge.img+2

I know I'm being lazy by not thoroughly researching the available documentation, but maybe there's a simple yes/no answer to my question: can I directly export a .fmw workbench transformation to a Python module(s)? The closest analog I can think of is like in ArcGIS, where you can export a ModelBuilder diagram into a Python script.

Best answer by redgeographics

FME doesn't offer this option.

View original
Did this help you find an answer to your question?

9 replies

redgeographics
Celebrity
Forum|alt.badge.img+49
  • Celebrity
  • Best Answer
  • August 30, 2018

FME doesn't offer this option.


rudystricklan1
Contributor
Forum|alt.badge.img+2
redgeographics wrote:

FME doesn't offer this option.

Thanks @redgeographics. The follow-up question would then be, what would be the best documentation source, in your experience, to plow through and understand how to use the Python API for my purposes?

 


redgeographics
Celebrity
Forum|alt.badge.img+49
rudystricklan1 wrote:
Thanks @redgeographics. The follow-up question would then be, what would be the best documentation source, in your experience, to plow through and understand how to use the Python API for my purposes?

 

That would be the FME Pluginbuilder API reference and this article

 

 


lifalin2016
Contributor
Forum|alt.badge.img+29
  • Contributor
  • August 31, 2018

If your whole transformation is located inside a custom transformer, i.e. a tab beside "Main", you can right-click on that custom transformer tab, and choose "Export as custom transformer". This will export it as a single FMX file. No Python though.

Cheers


rudystricklan1
Contributor
Forum|alt.badge.img+2

Thank you, @redgeographics and @lifalin2016. Seems like having the ability to export a FMX to Python would be a great feature. Trying to retrofit FMX with functionality like list comprehension is really cumbersome to work with. Maybe I'm missing something really basic, but my understanding is that you can add Python API calls to a FMX, not the other way around (i.e., calling FMX functionality from a standalone Python module). Is that true?


lifalin2016
Contributor
Forum|alt.badge.img+29
  • Contributor
  • September 3, 2018
rudystricklan1 wrote:

Thank you, @redgeographics and @lifalin2016. Seems like having the ability to export a FMX to Python would be a great feature. Trying to retrofit FMX with functionality like list comprehension is really cumbersome to work with. Maybe I'm missing something really basic, but my understanding is that you can add Python API calls to a FMX, not the other way around (i.e., calling FMX functionality from a standalone Python module). Is that true?

You cannot access details of an FME translation, e.g. transformers, from Python directly (except by deciphering the FMX). But just as you can use Python to build transformers for FME by utilizing fmeobjects, so can you build custom Python apps outside FME, and do pretty much anything FME can, using fmeobjects. You may need to copy the fmeobjects folder to the standard Python lib folder, depending on how your IDE is set up.

 

 

The catch is the licensing. This will only work on your own machine with a valid FME license. And you can only distribute your app to other machines with a similar FME license.

 

 


rudystricklan1
Contributor
Forum|alt.badge.img+2
  • Author
  • Contributor
  • September 4, 2018

Thanks @lifalin2016. I'm at that cusp of FME Workbench expertise where I'm spending more time trying to fit it into a programming environment that I'm familiar with rather than sitting down and figuring out how to set up workflows entirely within FME :-).


fmelizard
Safer
Forum|alt.badge.img+18
  • Safer
  • September 4, 2018
rudystricklan1 wrote:

Thanks @lifalin2016. I'm at that cusp of FME Workbench expertise where I'm spending more time trying to fit it into a programming environment that I'm familiar with rather than sitting down and figuring out how to set up workflows entirely within FME :-).

Do you just want to run an FME Workspace from Python? Passing in the arguments? Feels like this article could be helpful: https://knowledge.safe.com/articles/1158/run-an-fme-workspace-from-python-using-fmeworkspac.html

 

 


Forum|alt.badge.img
fmelizard wrote:
Do you just want to run an FME Workspace from Python? Passing in the arguments? Feels like this article could be helpful: https://knowledge.safe.com/articles/1158/run-an-fme-workspace-from-python-using-fmeworkspac.html

 

 

@daleatsafe-- good to hear back from one of the Chiefs :-). What I'm showing for a class exercise at the University of Arizona is actually the lazy way out: running the fmw in a Python subprocess.call, pulling the necessary parameters that are being written to a text file table in the fmw transformation. I'll dig into the inverse method of calling the fmw from Python, though.

 

 

Best regards,

 

 

Rudy

 


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