feat(sdk): add util module with collect helper func; update spin-kv example to suit#139
Merged
vdice merged 1 commit intospinframework:mainfrom Apr 8, 2026
Merged
Conversation
0e0d7c1 to
5c8dfdc
Compare
dicej
approved these changes
Apr 7, 2026
Collaborator
dicej
left a comment
There was a problem hiding this comment.
LGTM, thanks! Just one doc tweak suggestion inline.
6564e59 to
749cd69
Compare
…xample to suit Signed-off-by: Vaughn Dice <vdice@akamai.com> Co-authored-by: Joel Dice <joel.dice@akamai.com>
749cd69 to
5b224e3
Compare
itowlson
reviewed
Apr 8, 2026
| T = TypeVar('T') | ||
| E = TypeVar('E') | ||
|
|
||
| async def collect(tuple: Tuple[StreamReader[T], FutureReader[Result[None, E]]]) -> List[T]: |
Contributor
There was a problem hiding this comment.
Will this be usable for PostgreSQL and SQLite rows? The APIs there return (list<column>, stream<row>, future<result>) rather than the mere 2-tuple of get-keys - can users still call this as collect(stream, future) or would they need to re-tuple the stream and future?
Wow I explained that badly but hopefully makes sense.
Collaborator
There was a problem hiding this comment.
You could do something like this:
columns, stream, result = connection.execute_async(statement, parameters)
rows = collect((stream, result))
Collaborator
There was a problem hiding this comment.
So yes, you'd need to re-tuple, but the syntax for that is pretty simple.
Contributor
Author
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
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.
Closes #134