-
Notifications
You must be signed in to change notification settings - Fork 119
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
Difficulty using the stream_arrow API #418
Comments
What I'm currently doing to hack around manually specifying a schema is this: fn fetch_schema_for_query(db: &Connection, sql: &str) -> duckdb::Result<SchemaRef> {
// Append "LIMIT 0" so DuckDB returns the same columns but no rows.
let schema_sql = format!("{} LIMIT 0", sql);
let mut statement = db.prepare(&schema_sql)?;
let arrow_result = statement.query_arrow([])?;
Ok(arrow_result.get_schema())
} It's extremely hackish in my opinion, but it does work. I feel like I'm either missing something obvious in the API or else it's just not very ergonomic. Any ideas? I can also confirm (for any googlers landing here) that the |
It seems that |
You might want to look over the PR that adds the API. |
The
stream_arrow
API onStatement
is rather clunky to use, since it requires aSchemaRef
argument. I'm not quite sure whyquery_arrow
doesn't require this, butstream_arrow
does.Additionally, it's not documented what the differences between the APIs are. I would presume that the
stream_arrow
API is going to be more memory efficient (as best I can tell at a glance,query_arrow
loads everything into memory and doesn't release till it's done), but this isn't explicitly documented anywhere.The text was updated successfully, but these errors were encountered: