-
Notifications
You must be signed in to change notification settings - Fork 199
Change experimental_python_types to legacy_primitive_types. Invert lo… #308
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
Change experimental_python_types to legacy_primitive_types. Invert lo… #308
Conversation
README.md
Outdated
|
|
||
| conn = trino.dbapi.connect( | ||
| experimental_python_types=True, | ||
| legacy_primitive_types=False, |
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.
This doesn't really make sense as this is the default. I would just remove this code fragment
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.
removed
| rows = cur.fetchall() | ||
|
|
||
| if expected: | ||
| if not expected: |
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.
Maybe it makes sense to rename expected into something more explicit, eg legacy_primitive_types_expected
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.
renamed to expected_legacy_primitive_types
|
|
||
| def test_decimal_query_param(trino_connection): | ||
| cur = trino_connection.cursor(experimental_python_types=True) | ||
| cur = trino_connection.cursor(legacy_primitive_types=False) |
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.
Please omit the parameter as the default is tested in test_legacy_primitive_types_with_connection_and_cursor
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.
omitted
898ad81 to
4653c60
Compare
4653c60 to
fd28548
Compare
README.md
Outdated
| "session_properties": {'query_max_run_time': '1d'}, | ||
| "client_tags": ["tag1", "tag2"], | ||
| "experimental_python_types": True, | ||
| "legacy_primitive_types": True, |
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.
Remove these entries, these code parts tend to be copied by users and we would rather not let them set this to True.
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.
removed
README.md
Outdated
| 'session_properties={"query_max_run_time": "1d"}' | ||
| '&client_tags=["tag1", "tag2"]' | ||
| '&experimental_python_types=true' | ||
| '&legacy_primitive_types=true' |
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.
Same here.
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.
removed
README.md
Outdated
| port=8080, | ||
| client_tags=["tag1", "tag2"], | ||
| experimental_python_types=True | ||
| legacy_primitive_types=True |
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.
Same here
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.
removed
fd28548 to
665f8d3
Compare
|
@hashhar would you have some time to look at this PR? Please approve if you are ok with these changes 🙂 |
hashhar
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.
Do we have any test with legacy_primitive_type=True for values which cannot be represented by Python types - just to make sure that the primitive code path doesn't use Python types anywhere at all.
The important cases I can think of are with parametric timestamps since the parsing logic uses Python types IIRC.
README.md
Outdated
| exits the *with* context and the queries succeed, otherwise | ||
| `trino.dbapi.Connection.rollback()` will be called. | ||
|
|
||
| ## Improved Python types |
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.
| ## Improved Python types | |
| ## Legacy Primitive types |
since this section now describes how to use the legacy behaviour.
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.
changed
665f8d3 to
eb72e00
Compare
eb72e00 to
b925efe
Compare
This commit makes the behaviour of experimental_python_types enabled to be the default. It introduces a new connection parameter legacy_primitive_types which can be enabled to restore the old default behaviour of type mapping.
b925efe to
b0a9e0d
Compare
|
Just reworded the commit message. As a follow-up do you think we should add a table of what Trino types map to what Python types and vice-versa? |
Description
Resolves #305
Change experimental_python_types to legacy_primitive_types. Invert logic behind interpreting this parameter.
Non-technical explanation
Release notes
( ) This is not user-visible or docs only and no release notes are required.
( ) Release notes are required, please propose a release note for me.
(x) Release notes are required, with the following suggested text: