This example demonstrates how to:
- Define a job that takes parameters with values that derive from the bundle.
- Use the path parameter to augment Python's
sys.pathto import a module from the bundle. - Access job parameters from the imported module.
- Databricks CLI v0.230.0 or above
This example includes a unit test for the function defined under my_custom_library that you can execute on your machine.
# Setup a virtual environment
uv venv
source .venv/bin/activate
uv pip install -r ./requirements.txt
# Run the unit test
python -m pytestTo deploy the bundle to Databricks, follow these steps:
- Update the
hostfield underworkspaceindatabricks.ymlto the Databricks workspace you wish to deploy to. - Run
databricks bundle deployto deploy the job. - Run
databricks bundle run print_bundle_configurationto run the job.
Example output:
% databricks bundle run print_bundle_configuration
Run URL: https://...
2024-10-15 11:48:43 "[dev pieter_noordhuis] Example to demonstrate job parameterization" TERMINATED SUCCESS
Navigate to the run URL to observe the output of the loaded configuration file.
You can execute the same steps for the prod target.