-
Notifications
You must be signed in to change notification settings - Fork 194
Introduce DecodableSegment and remove Tuple in iterators #525
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
Merged
+57
−34
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This is part of the contract which is not used in the JSON encoding scheme but will be in the future for other formats.
6114f7a
to
0fc43cc
Compare
@mdesmet I've dropped the Tuple and the API feels more natural now |
This makes the API much easier to consume in the `segments` cursor style: ``` cur = conn.cursor('segment') cur.execute(sql) segments = cur.fetchall() total_row_count = 0 row_mapper = RowMapperFactory().create(columns=cur._query.columns, legacy_primitive_types=False) for segment in segments: rows = list(SegmentIterator(segment, row_mapper)) print ("rows length is " + str(len(rows)) + " " + segment.encoding) total_row_count += len(rows) print(total_row_count) ``` This will work as well: ``` cur = conn.cursor('segment') cur.execute(sql) segments = cur.fetchall() total_row_count = 0 row_mapper = RowMapperFactory().create(columns=cur._query.columns, legacy_primitive_types=False) rows = list(SegmentIterator(segments, row_mapper)) print ("rows length is " + str(len(rows))) total_row_count += len(rows) print(total_row_count) ```
0fc43cc
to
ac3d3f5
Compare
Sending authorization headers will make S3 presigned uris to fail due to additional headers that cannot be present.
@hashhar ptal, alas it's a breaking change but it was broken API from the beginning and since it was in a single release so far, I think we should just fix it and move along |
hashhar
approved these changes
Feb 3, 2025
@hashhar can we release new version? |
13 tasks
GaetanLepage
pushed a commit
to NixOS/nixpkgs
that referenced
this pull request
Apr 24, 2025
* Improve handling of query results containing `null` values for the error field. ([#512](trinodb/trino-python-client#512)) * Fix accessing spooled segments on S3 when authentication to the Trino cluster is used. ([#525](trinodb/trino-python-client#525)) * Simplify `segment` cursor API to make it easier to iterate over spooled segments. ([#525](trinodb/trino-python-client#525))
mkg20001
pushed a commit
to mkg20001/nixpkgs
that referenced
this pull request
Apr 29, 2025
* Improve handling of query results containing `null` values for the error field. ([NixOS#512](trinodb/trino-python-client#512)) * Fix accessing spooled segments on S3 when authentication to the Trino cluster is used. ([NixOS#525](trinodb/trino-python-client#525)) * Simplify `segment` cursor API to make it easier to iterate over spooled segments. ([NixOS#525](trinodb/trino-python-client#525))
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This makes the API much easier to consume in the
segments
cursor style:This will work the same: