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

API Variable Defaults

I am looking for a way to set defaults as part of deployments. Can this be done via the API?

5 Community Answers

Matillion Agent  

Ian Funnell —

Hi John,

You can set default values for your Environment Variables, and then use them in an API Profile as described in this document

Is that the kind of thing you are trying to achieve?

Best regards,
Ian


John Racer —

We are working through moving one project to another. When we export the variables and import the project into another environment the defaults are not included. If possible we would like to update via an api call as part of the migration.

{"jobsTree":{"id":1583,"name":"ROOT","children":[],"jobs":[]},"orchestrationJobs":[],"transformationJobs":[],"variables":[{"name":"var_audit_rowcount","type":"DECIMAL","scope":"BRANCH"},{"name":"var_flg_dim_type_code","type":"TEXT","scope":"TASKBATCH"},{"name":"tst_tab_inst","type":"TEXT","scope":"TASKBATCH"}],"environments":[]}


Matillion Agent  

Ian Funnell —

Hi John,

Understood, yes. We deliberately exclude the values from exports, because the target environments are likely to be different, so unfortunately it isn’t possible.

We do have an enhancement in the development backlog (internal reference EMD-4394) which will allow text mode editing for environment variables. This should make it much easier to set all the default values the same across projects.

Best regards,
Ian


John Racer —

It is fine if the values cannot be exported but I would like to be able to import them. Before moving between environments we are checking the Project json in to git. Is it possible to add these values in the json file itself prior to import of is there anyway that these variables could be updated via the API. Our approach is to completely automate deployments so that we have a repeatable deployment that does not introduce the risk of typos, etc... We would prefer to manage these, by environment, in git to avoid, almost certain, human error.


Matillion Agent  

Ian Funnell —

Hi John,

If you’re intending to automate this (which is what we do ourselves) then the best way is to use Matillion’s REST API

You can automate the export and import of an entire project, including variables and their values.

A typical export command (from a Matillion instance at IP address 1.2.3.4) might be:

curl -o fullbackup.json -k -X GET -u ec2-user:your-password -H "Content-Type: application/json" "https://1.2.3.4/rest/v0/projects?groupName=Your%20Group&projectName=Your%20Project&versionName=default&export=true"

Then, an import command (to a Matillion instance at IP address 5.6.7.8) might be

curl -k -u ec2-user:your-password -X POST "https://5.6.7.8/rest/v0/projects" -H "Content-Type: application/json" --data-binary @fullbackup.json

Best regards,
Ian

Post Your Community Answer

To add an answer please login