Issue passing date parameters from dateRange to a Databricks query

I’m trying to run a Databricks query from Retool, passing the dates as parameters from a dateRange component.
If I write the dates manually in the query, it works and returns data.

However, when I try to use the component values as parameters, I get an error.
I’ve tried:
Thanks in advance!

  • Using single ' and double " quotes around the parameter.
  • Using date() or CAST() to convert it.

None of these attempts have worked

This works if I replace {{ dateRange.value.start }} and {{ dateRange.value.end }} with fixed dates like '2025-08-01' and '2025-08-05', but fails when using parameters.
Gr


Hi @Lucia_Gomez, I looked up some threads on this and it seems likely to be a syntax issue. I know single quotes vs double quotes is often an issue so maybe try adding single quotes around the dateRange like so: created_at >= '{{dateRange11.value.start}}' and created_at <= '2025-08-01'

Hello Mike!
I have also tried that option and still get the error. Still don't know how to solve it. Thanks for your answer

Oh, you totally mentioned single vs double quotes in your original post, my mistake!

I looked a little deeper into this, and you may have to modify the resource to turn this setting on: "Disable converting queries to prepared statements"


With prepared statements enabled (unchecked), it will try to translate your interpolations into JDBC bind parameters. I'm guessing that its having difficulty resolving those parameters based on the errors it gave you.
By turning that setting on, technically it's up to you to ensure that anything you interpolate into a query can't be SQL injected. Thankfully there is no risk for SQL injection with a date range, so it should be fine.

1 Like