Skip to main content

Hi Fme team,

After completion of fme script, i need to run sql query for the resultant destination table. So I am running sql thru end python script. And for this sql query I need one variable(fme published parameter or fme attribute)

from jest ran fme script. is there any way i can get value from fme published parameter into end python.

 

pls help.

Which writer are you using?

Some writers have a setting for an SQL command to execute after the writer terminates, have you looked into that?


You can access published or private parameters in any Python code using the FME_MacroValues dictionary, e.g.

my_value = FME_MacroValuesÂ'MY_PUBLISHED_PARAMETER']

does it work inside shutdown Python script ?


@david_r

i use oracle spatial writer, And i am running shutdown python script.

can i access FME_MacroValues inside shutdown python?

 


You can access published or private parameters in any Python code using the FME_MacroValues dictionary, e.g.

my_value = FME_MacroValuesÂ'MY_PUBLISHED_PARAMETER']
It works in any Python code, so yes, it also works in the shutdown script.

The Oracle Spatial Object writer does indeed have the "SQL to run after writer" setting:

You can reference published parameter inside it using $(PARAMETER_NAME) notation.


@david_r

One quick question,

Calling python function inside shut down python script is not working for me?

for example

import fme 
import fmeobjects
make_a_sound()
def make_a_sound():
    print('quack')

Python Exception <NameError>: name 'make_a_sound' is not defined

Error executing string `import fme

 

 

its giving error


@david_r

One quick question,

Calling python function inside shut down python script is not working for me?

for example

import fme 
import fmeobjects
make_a_sound()
def make_a_sound():
    print('quack')

Python Exception <NameError>: name 'make_a_sound' is not defined

Error executing string `import fme

 

 

its giving error

Python scripts (like most programming languages) are interpreted top-down, meaning that you must put the declaration of "make_a_sound" before you call it, e.g.

 

def make_a_sound():
    print('quack')

make_a_sound()

Reply