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

Support row parsing for PROTO & ENUM column Types #333

Closed
henriquegmendes opened this issue Dec 30, 2024 · 1 comment · Fixed by #342
Closed

Support row parsing for PROTO & ENUM column Types #333

henriquegmendes opened this issue Dec 30, 2024 · 1 comment · Fixed by #342
Assignees
Labels
priority: p3 Desirable enhancement or fix. May not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@henriquegmendes
Copy link

henriquegmendes commented Dec 30, 2024

Is your feature request related to a problem? Please describe.
Spanner supports proto ENUM types when creating a table schema. However, this library doesn't allow parsing a queried row back into the proto enum type. Same happens with a raw proto type, which is also allowed by Spanner database.

Ex: when attempting to query a row that has an ENUM typed column, this library returns the following error: unsupported element type ENUM

Error happens right here: https://github.com/googleapis/go-sql-spanner/blob/main/rows.go#L273 --- The switch case doesn't include TypeCode_PROTO & TypeCode_ENUM types currently available on spanner library, so the above mentioned error gets triggered

Describe the solution you'd like
Add support to TypeCode_PROTO & TypeCode_ENUM types while parsing Spanner queried rows using this library

Describe alternatives you've considered
The alternative would be to use the raw spanner client to parse queried rows, but I wanted to use GORM package, which depends on go-sql-spanner library.

@henriquegmendes henriquegmendes added priority: p3 Desirable enhancement or fix. May not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. labels Dec 30, 2024
@olavloite olavloite self-assigned this Jan 14, 2025
olavloite added a commit that referenced this issue Jan 15, 2025
PROTO columns are returned as []byte. ENUM columnns are returned
as INT64. This enables the use of these columns through the standard
database/sql Scan method.

Fixes #333
olavloite added a commit that referenced this issue Jan 15, 2025
PROTO columns are returned as []byte. ENUM columnns are returned
as INT64. This enables the use of these columns through the standard
database/sql Scan method.

Fixes #333
@henriquegmendes
Copy link
Author

Thanks!!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p3 Desirable enhancement or fix. May not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants