You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
DataFusion supports PREPARE statements, with flavors to suit all tastes such as explicit or inferred types, and positional or named arguments. I noticed docs for this feature are entirely missing from the SQL Reference (link).
Activity
alamb commentedon Nov 27, 2024
Yes, thank you @leoyvens
@NGA-TRAN , @erratic-pattern and @jonahgao have done some great work in this area and indeed it would be great to get it documented
dhegberg commentedon Feb 10, 2025
I've started to put together some basic documentation for prepared statements, but when generating examples I'm struggling to use named parameters.
Using
SessionContext::sql()for example will hit this validation ensuring a$1style placeholder is used rather than:name.Creating a logical plan from the SQL string has a similar issue, preventing the user from later calling
replace_params_with_values.alamb commentedon Feb 10, 2025
Thanks @dhegberg -- I am not sure if that is desired or not -- maybe it is worth a ticket
jonahgao commentedon Feb 10, 2025
I think it should be supported because this test can be passed.
But it seems that we can't EXECUTE it by SQL.
dhegberg commentedon Feb 10, 2025
I think I'll post my documentation change without the named arguments. I'll then take a stab at adding support for named arguments with EXECUTE.
dhegberg commentedon Feb 10, 2025
take
dhegberg commentedon Feb 19, 2025
I was looking at how to support named parameters for PREPARE statements.
I expected the supported syntax in SQL dialects to looks something like:
That sort of syntax does not seem to be present in most dialects, with a few exceptions (like sqlite)
What is the expected behavior / syntax we're look for with named parameters in the context of a prepared statement?
jonahgao commentedon Feb 19, 2025
Maybe we can follow DuckDB's syntax; it seems quite readable to me.
https://duckdb.org/docs/sql/query_syntax/prepared_statements.html#named-parameters-parameter