Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Lets say my first cell in my Fabric notebook is:
Solved! Go to Solution.
Hi @Sperling
You can try a two-step approach:
Capture the Widget Value in PySpark: First, ensure you capture the value from the widget in a PySpark cell. You've already done this part.
import ipywidgets as widgets ADF_PipelineRunId = widgets.Text(description="ADF_PipelineRunId", value="00000000-0000-0000-0000-000000000000") display(ADF_PipelineRunId)
Pass the Value to a T-SQL Query: Next, you'll need to use PySpark to dynamically construct your T-SQL query string with the widget's value included. This can be done by creating a query string in PySpark and then executing it using the Spark SQL context.
Here's how you can do it:
# Assuming ADF_PipelineRunId.value holds the value you want to pass to your T-SQL query
query = f"""
SELECT '{ADF_PipelineRunId.value}' AS ADF_PipelineRunId
"""
spark.sql(query)
This approach involves constructing the SQL query as a string in PySpark, where you can dynamically insert the widget's value. Then, you execute this query using Spark SQL (spark.sql). This way, you can pass parameters from PySpark widgets to your SQL context.
If this doesn't work, you can also seek help at the Synapse forum: Get Help with Synapse
Best Regards,
Jing
If this post helps, please Accept it as Solution to help other members find it. Appreciate your Kudos!
Hi @Sperling
You can try a two-step approach:
Capture the Widget Value in PySpark: First, ensure you capture the value from the widget in a PySpark cell. You've already done this part.
import ipywidgets as widgets ADF_PipelineRunId = widgets.Text(description="ADF_PipelineRunId", value="00000000-0000-0000-0000-000000000000") display(ADF_PipelineRunId)
Pass the Value to a T-SQL Query: Next, you'll need to use PySpark to dynamically construct your T-SQL query string with the widget's value included. This can be done by creating a query string in PySpark and then executing it using the Spark SQL context.
Here's how you can do it:
# Assuming ADF_PipelineRunId.value holds the value you want to pass to your T-SQL query
query = f"""
SELECT '{ADF_PipelineRunId.value}' AS ADF_PipelineRunId
"""
spark.sql(query)
This approach involves constructing the SQL query as a string in PySpark, where you can dynamically insert the widget's value. Then, you execute this query using Spark SQL (spark.sql). This way, you can pass parameters from PySpark widgets to your SQL context.
If this doesn't work, you can also seek help at the Synapse forum: Get Help with Synapse
Best Regards,
Jing
If this post helps, please Accept it as Solution to help other members find it. Appreciate your Kudos!
Hi @Anonymous
I found a solution with your approach. I'm combining it with data from another source, but I just made my initial query in python and added the parameters, and then continued with T-SQL using the spark.sql query.
Thanks for the help!
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
Check out the November 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 69 | |
| 46 | |
| 44 | |
| 28 | |
| 19 |
| User | Count |
|---|---|
| 199 | |
| 129 | |
| 102 | |
| 69 | |
| 55 |