-
Notifications
You must be signed in to change notification settings - Fork 11
feat: Fir 16953 bytea support #235
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
Conversation
ptiurin
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Otherwise, looks good
| BYTEA_PREFIX = "\\x" | ||
|
|
||
|
|
||
| def _parse_bytea(str_value: str) -> bytes: | ||
| return bytes.fromhex(str_value[len(BYTEA_PREFIX) :]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we check if the string starts with the correct prefix?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My idea was that it might be a pretty heavy operation on a large scale (since string slice is basically copy). Yet, I think we should be fine in a general case, we have less performant pieces anyway
| data = "bytea_123" | ||
|
|
||
| await c.execute( | ||
| "INSERT INTO test_bytea_roundtrip VALUES (1, ?)", (Binary(data),) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd add a couple of special characters here as well, just to make sure we handle them correctly. e.g. '\n', '\', ヽ༼ຈل͜ຈ༽ノ
tests/integration/dbapi/conftest.py
Outdated
| 'decimal(38,30)) as "decimal", ' | ||
| "cast(null as int) as nullable" | ||
| "cast(null as int) as nullable, " | ||
| "'abc123'::bytea as bytea" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a heads-up, unquoted identifiers are not supposed to work and SQL team has just released a fix. We should change this to as "bytea" and any other new types that worked this way.
1078992 to
258112a
Compare
c026bf7 to
5f2660e
Compare
|
SonarCloud Quality Gate failed. |








Added support for bytea type (both parsing and formatting)