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

Create and delete variable with python

Hi.
Is it possible to use the python component to create and delete variables?

3 Community Answers

Matillion Agent  

Kalyan Arangam —

Hi Johan,

Yes, variables can be created in the python script component. However, they do not persist outside the script block they were created in.

To persist a value outside the script block, you need to assign the value to a variable declared via “Project → Manage Environment Variables”.
Use the following syntax to pass a value from locally declared variable to an Environment variable -

context.updateVariable(‘env_variable’, ‘new-value’)

Hope that helps.

Best
Kalyan


Johan Forssell —

Hi Kalyan.
So there is no way to create/delete environment varibables programatically? So if i want to create varibles thats only used through one orchestration job i need to create a global enviroment variable for my entire project and update this as i enter the job?


Matillion Agent  

Kalyan Arangam —

hi Johan,

You are right. For now, there is no support for creating Global variables programmatically.

Variables are either declared globally and available to the whole project or available locally within a Bash/Python script component.

Best Regards
Kalyan

Post Your Community Answer

To add an answer please login