Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pivot not working with prepared statements #310

Open
l1xnan opened this issue May 16, 2024 · 1 comment
Open

Pivot not working with prepared statements #310

l1xnan opened this issue May 16, 2024 · 1 comment

Comments

@l1xnan
Copy link

l1xnan commented May 16, 2024

Executing the pivot statement results in the following error:

let sql = r"
with tbl as (
  select * from read_parquet('test.parquet')
)
PIVOT tbl on a using sum(b)";
let con = duckdb::Connection::open_in_memory().unwrap();
let stmt = con.prepare(sql);
println!("{:?}", stmt);
// Err(DuckDBFailure(Error { code: Unknown, extended_code: 1 }, Some("Invalid Input Error: Cannot prepare multiple statements at once!")))

It may be related to duckdb/duckdb#7720

@era127
Copy link
Contributor

era127 commented May 25, 2024

In my experience with another client api, this was resolved by using the duckdb_query() c api function which will create a materialized result. When using the arrow api it will run with the similar duckdb_query_arrow() which is used with execute_batch(). However execute_batch does not return the result. I think if execute_batch was modified to return the output or a new query() function was add to the Connection then it would work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants