-
Notifications
You must be signed in to change notification settings - Fork 128
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
Update python examples #529
Conversation
Update python example
- column: data | ||
data_type: bytes | ||
# base64 bytes value |
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.
mention decoded value of base64 string to understand what we should expect: "test-data"
examples/python/example_with_zone.py
Outdated
@@ -25,16 +25,16 @@ def print_data(zone_id, connection): | |||
console""" | |||
result = connection.execute( | |||
# explicitly pass zone id before related data | |||
select([cast(zone_id.encode('utf-8'), BYTEA), test_table])) | |||
select([literal_column("'{}'".format(zone_id)), test_table])) |
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.
what about to avoid manual escaping values, use sqlalchemy's engine and specify type_
value for literal_column? I think that we can specify String type to apply escape rules for string values (according to TypeEngine documentation)?
if it will works, I prefer to use such approach. Because it will automatically work for mysql and all other DBs if we will add them.
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.
Sounds good, let me check it.
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 used sqlalchemy's literal
, it performs escaping values inside. What do you think @Lagovas ?
Fixed after review
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.
lgtm if it works with literal
. I remember that had some problems with that. But probably it was related with compiling queries with bound values.
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.
lgtm
# Conflicts: # examples/python/encryptor_config_with_zone.yaml
* zhars/update_python_examples Update python examples
Actualizing python examples.
encryptor_config_*
with explicit table declaration to run with transparent encryption and be able to show type awareness functionalityzone_id
field to be able to match zone from the query but not from the table.write_data
function with explicit zone_id literal - deletedcast
operator as it is not supported by Acra sql parser now.Checklist
with new changes