Have you tried to manually create a Published Parameter of the type 'Scripted (Python)' and than to link it to your reader?
@lars_de_vries: In my case I do not need it for a reader database name or password, but for a job submitter like here:
The variable $(SERVER_CONNECTION) is the one that should be scriptable.
If you want to use a scripted parameter in combination with a config file, I would recommend the following:
FME Workbench:
- Create a subdirectory in the directory where your .fmw file is located. Call this subdirectory 'config'.
- Create a new file __init__.py in the config directory.
- Put the configuration parameters you need in the __init__.py file as key value pairs:
host_dev=http://fme-dev.com/
user_dev=admin
password_dev=admin
host_prod=http://fme-prod.com/
user_prod=admin
password_prod=admin
- In your FME Workspace, create a new Scripted (Python) parameter for each property from your config you need. Return the required value like this (host_dev in this case):
import config as conf
return conf.host_dev
FME Server:
To be able to use your config file, you will need to upload the config to your FME Servers:
Upload the config-directory and the __init__.py file to resources/Engine/Plugins/python/python27
The result will be a 'config' directory inside the python27 directory.
With that done, your scripted parameters will read the config uploaded to the FME Server.
If you want to use a scripted parameter in combination with a config file, I would recommend the following:
FME Workbench:
- Create a subdirectory in the directory where your .fmw file is located. Call this subdirectory 'config'.
- Create a new file __init__.py in the config directory.
- Put the configuration parameters you need in the __init__.py file as key value pairs:
host_dev=http://fme-dev.com/
user_dev=admin
password_dev=admin
host_prod=http://fme-prod.com/
user_prod=admin
password_prod=admin
- In your FME Workspace, create a new Scripted (Python) parameter for each property from your config you need. Return the required value like this (host_dev in this case):
import config as conf
return conf.host_dev
FME Server:
To be able to use your config file, you will need to upload the config to your FME Servers:
Upload the config-directory and the __init__.py file to resources/Engine/Plugins/python/python27
The result will be a 'config' directory inside the python27 directory.
With that done, your scripted parameters will read the config uploaded to the FME Server.
Thanks, @nielsg
This is the way I will go, refining it with ini-style config files.
I was glad to find out that the fme-server-connections that are used by the FMEServerJobSubmitter can be coded as plain strings, assuming that such a connection is defined in the server environment. This alleviates my task tremendously.