Skip to main content

I would like to run the same workspace multiple times but with a different source geodabase each time. Basically, I want to run it once for each geodatabase in a given folder. I believe this could be scripted with Python, but am not entirely sure where to start.

Any suggestions or script samples is appreciated.

Is there any reason for you to search in Python instead of using Workspace Runner in FME?


You can use the reader "Directory and File Pathnames" to look for folders ending with .gdb, then send those to the WorkspaceRunner with a workspace that treats each one individually:


You can use the reader "Directory and File Pathnames" to look for folders ending with .gdb, then send those to the WorkspaceRunner with a workspace that treats each one individually:

Yes, check out this example to see exactly how it is done.


Is there any reason for you to search in Python instead of using Workspace Runner in FME?

No reason other than I am a newby at this and thought Python was required.

So is the idea to use Workspace Runner to grab the filenames in the directory, and then for each filename, pass it into the workspace parameters and execute?


No reason other than I am a newby at this and thought Python was required.

So is the idea to use Workspace Runner to grab the filenames in the directory, and then for each filename, pass it into the workspace parameters and execute?

Yes, you use the Directory and File Pathnames reader to grab the filenames, then for each filename (i.e. each feature that exits the reader), you fire off another workspace with the WorkspaceRunner, passing the gdb filename as a published parameter.


Ok, thanks. Have the directory/file pathnames reader working. I have the generic workspace set up as well with the published parameter. What is confusing is that I am not sure how to loop through the filenames from the reader.


So you should have two FMWs at this point: one that does all your translations (let's call it Processor.fmw) and another fmw that uses the directory/file pathnames reader to feed the *.gdb names to the processor.fmw using a WorkspaceRunner Transformer. When you hook the Reader to the WSR and examine the parameters on the WSR, you will see the public parameter you set up on the processor.fmw. Using the dropdown arrow, you can set the parameter to one of the Reader's outputs like path_windows.


So you should have two FMWs at this point: one that does all your translations (let's call it Processor.fmw) and another fmw that uses the directory/file pathnames reader to feed the *.gdb names to the processor.fmw using a WorkspaceRunner Transformer. When you hook the Reader to the WSR and examine the parameters on the WSR, you will see the public parameter you set up on the processor.fmw. Using the dropdown arrow, you can set the parameter to one of the Reader's outputs like path_windows.

Worked perfectly. Thank you.


Worked perfectly. Thank you.

Awesome. Glad to help. (Though, in truth, all I did was diagram david_r's response :-))


Reply