Name is required.
Email address is required.
Invalid email address
Answer is required.
Exceeding max length of 5KB

Updating Variables

Hi,

I'm using this python script to update an Environment Variable :

cursor = context.cursor()
cursor.execute('select cast(max(right("$path",8)) as int) from eds')
max_mill = cursor.fetchone()[0]
context.updateVariable('Mill_max_date', max_mill)

After running the script, the Environment Variable (Mill_max_date) value does not update.
Is there a better way to update the value permanently?

3 Community Answers

Matillion Agent  

Arawan Gajajiva —

Hi Mehrdad -

The syntax you have provided looks correct for setting the value of a variable from within a Python script. How are you identifying that the variable was not set properly? I’m wondering if there is something else going on in your Orchestration job that might be causing the behavior you are experiencing. For instance, if you add this additional debugging line to the end of your Python script, that should help to verify if the variable was set properly:

print Mill_max_date

Best Regards,
Arawan


Mehrdad Khojasteh —

Hi Aeawan,

Yes, when I use print command, it shows the value of the variable (Mill_max_date) is updated but just for that orchestration job and not permanently. If in another job I call the same variable, It doesn't show the updated value. I'm looking to update the value of the variable permanently so if I called my variable, I can us the updated value every time.

Thank You,

Mehrdad


Matillion Agent  

Laura Malins —

Hi Mehrdad

When you update the variable, it will only update for that running job and any other jobs initiated from that job. If you run another job separately or once that job run has completed the variable will fall back to the default.

If you need to update the variable permanently then you need to update the default value via the web interface.

Thanks
Laura

Post Your Community Answer

To add an answer please login