Databricks asset bundles in Python: referencing variables

daan_dw
New Contributor III

Hey,

I am using DAB's and in my .yml files I can reference my variables set in my databricks.yml like this: 

git_branch: ${var.branch}
I would like to do the same thing in my DAB's written in Python but I cannot find any documentation on how to do this.
 
How can I do this?

Thanks! 

SP_6721
Honored Contributor II

Hi @daan_dw ,

To reference variables defined in your databricks.yml in Python DAB code, define your variables class and use bundle.resolve_variable

https://docs.databricks.com/aws/en/dev-tools/bundles/python/#access-bundle-variables