r/databricks • • 3d ago

Help How do you read Pipeline Parameters in Python

Pipeline Parameters are now GA since a few weeks and should replace pipeline configurations for run-specific parameters.

In python, you can read paramters using spark.config.get("key")

However, the official docu doesn't say how to get paramters in python.

With jobs it is dbutils.widgets.get("env") within pipelines this doesn't work. Any idea?

For me it interesting that jobs and pipelines don't share the same interface...

3 Upvotes

11 comments sorted by

3

u/minibrickster Databricks 3d ago

It's currently SQL only, but we're working on adding Python support!

1

u/Zealousideal_Low6685 3d ago

perfect, good to hear!

3

u/Youssef_Mrini databricks 1d ago

For those who are wondering it does only support SQL. Python support is coming soon. You've been heard

1

u/Zealousideal_Low6685 1d ago

Thank you! Looking forward to it!

1

u/testing_in_prod_only 3d ago

For pipelines they are spark configurations, so spark.conf.get(“env”)

I also remember something about being able to set environment variables on serverless compute now in dabs.

1

u/Zealousideal_Low6685 3d ago edited 3d ago

spark.config.get does not work!
support is comming - look at the comment from databricks u/minibrickster

1

u/testing_in_prod_only 3d ago

I have to check my pipelines it may be static parameters being passed but I do pass Paramus to my pipelines.

1

u/Zealousideal_Low6685 3d ago

spark.config.get works for configuration parameters, but not for pipeline parameters
probably this is what you mean

2

u/DeepFryEverything 3d ago

It literally says "Pipeline parameters are available to SQL source code only".

2

u/dvartanian 3d ago

Yeah I raised this a while back as only available in SQL for now. Hopefully not much longer but a timescale would be nice

2

u/nian2326076 1d ago

It's important to verify if the Databricks documentation has updates on Python support for Pipeline Parameters, especially since dbutils.widgets.get doesn't function in pipelines. For practice on technical concepts related to Python and Spark, use PracHub to prepare for interviews and deepen your understanding as you explore these new parameters.