-
Notifications
You must be signed in to change notification settings - Fork 306
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
The DB API Binary function should accept bytes. #628
Comments
This makes sense to me. (Both continue to accept strings, and also support bytes) I'm having trouble finding in the REST docs how we expect BYTES data type to be encoded, but presumably we have other support for this outside of the DB-API which we can reference. |
At a higher level:
Note that bytes input is handled correctly, but string input isn't. The |
From: https://cloud.google.com/bigquery/docs/reference/rest/v2/StandardSqlDataType "Encoded as a base64 string per RFC 4648, section 4." It appears that we encode this properly only for bytes data: python-bigquery/google/cloud/bigquery/_helpers.py Lines 295 to 299 in a322433
|
Bytes are the most common way to represent binary data. Accepting strings, as it does now seems at best to be a convenience and at worst a bug magnet.
In SQLAlchemy, if you defined a model that has a binary attribute, you'd store bytes data in it, but that would break for bigquery, di to this issue.
Sqlite's
Binary
function requires bytes data.I propose to change the function to accept bytes. For the sake of backward compatibility, I propose to continue to accept strings.
The text was updated successfully, but these errors were encountered: