Skip to content

Conversation

@paleolimbot
Copy link
Member

This PR proposes a 1.2 spec addition AdbcStatementRequestSchema(). There are a few decisions here and while I put specific language in I think any version of these is still helpful:

  • I wrote this up as this best-effort (like the PyCapsule requested_schema). I think this is better for negotiation (e.g., the caller calls execute schema, requests a schema with all strings/binary/list columns as views, and the driver produces string/binary views but not list views because it doesn't implement those). A strict version is also useful and might generate better errors.
  • Maybe struct ArrowSchema* should be const ArrowSchema*. I'm not sure this matters (mostly the C struct will be populated specifically for this call and they are easy to copy).
  • No opinions on RequestSchema as the name if there's a better one

The capability to do this is built in to the Postgres driver already for some types (the COPY reader was designed to always accept an arbitrary ArrowSchema, which we currently just infer before constructing the reader).

Other 1.2 spec additions in #3607 (which also contains the infrastructure for a new ADBC minor version).

Closes #1514 .

@lidavidm
Copy link
Member

Thanks for this!

I wonder if we also want to somehow allow things like "read 'field_name' as string view, but leave other fields alone" or "read all 'database_type' as string view, but leave other fields alone"

@paleolimbot
Copy link
Member Author

I wonder if we also want to somehow allow things like "read 'field_name' as string view, but leave other fields alone" or "read all 'database_type' as string view, but leave other fields alone"

Sure, or some version of an option get/set with of a list of supported or preferred types. Happy to take out the negotiation bit if that's confusing (the main purpose here is to help the driver make better choices for loose or row-based typing).

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

Successfully merging this pull request may close these issues.

feat: Add the ability to request a schema from a statement

2 participants