Question

Automating Reader/Writer Selection

  • 13 August 2019
  • 1 reply
  • 1 view

Badge

Is there a best way to automate what a MySQL Reader and Writer should use based on a specific file name?

 

For example if file name = foo.txt

Use the reader/writer DB connection for fooDB.

If file name = fooBar.txt

Use the reader/writer DB connection for fooBarDB

 

I know that User Params along with a Filter in the automation may make this possible, but I don't know if that's the best route to go. I would also like to refrain from having multiples of the same workflow for thier respective DB connections.

 

Thanks in advanced!


1 reply

Badge

Hello, Try following steps to automate the DB Connection.

1) Create published parameter as FileName and get the file name as variable by providing file name at the time of workspace run, Like below

2) Create private parameter and read the published parameter value through python script ex:-

import fme

DBName = fme.macroValues['FileName'].lower()

Return DB name and pass this variable as dataset for your MySql reader.

 

Hope this will work for you, I don't have environment to test this. Need to explore more from here.

 

Thanks..

 

Reply