Skip to content

Conversation

stepansergeevitch
Copy link
Collaborator

Added streaming support for python sdk

  • Created both asynchronous and synchronous streaming row set implementations
  • Added support for JSONLines new data types - integer, bigint, double precision, numeric
  • Added a new execute_stream for asynchronous and synchronous cursors V2

@stepansergeevitch stepansergeevitch self-assigned this Apr 15, 2025
@stepansergeevitch stepansergeevitch requested a review from a team as a code owner April 15, 2025 07:24
@stepansergeevitch stepansergeevitch changed the title FIR-43722 add streaming to python sdk feat: FIR-43722 add streaming to python sdk Apr 15, 2025
Comment on lines 85 to 86
in_memory_row_set_type = InMemoryRowSet
streaming_row_set_type = StreamingRowSet
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any particular reason to make those dynamic?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To refactor our the logic of initializing the row_set based on if we're streaming or not. Also maybe for readability

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It feels a bit overengineered for the purpose. These two are used in a single method, which in turn is used only in _do_execute. And I don't really think we expect them to change often so I'm not sure of the benefit here.
A one line can let us get rid of two attributes, a method and a base class method, which in turn would improve readablility:

self._row_set = StreamingRowSet() if streaming else InMemoryRowSet()

Copy link
Contributor

@ptiurin ptiurin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apart from those comments looks good!

Comment on lines +48 to +50
self.requires_response_body = True
response = yield self._make_auth_request()
self.requires_response_body = False
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This just feels really awkward. Maybe let's rethink the whole requires_response_body after this PR.

Comment on lines 85 to 86
in_memory_row_set_type = InMemoryRowSet
streaming_row_set_type = StreamingRowSet
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It feels a bit overengineered for the purpose. These two are used in a single method, which in turn is used only in _do_execute. And I don't really think we expect them to change often so I'm not sure of the benefit here.
A one line can let us get rid of two attributes, a method and a base class method, which in turn would improve readablility:

self._row_set = StreamingRowSet() if streaming else InMemoryRowSet()

Copy link

@stepansergeevitch stepansergeevitch merged commit a1bb428 into main Apr 18, 2025
8 checks passed
@stepansergeevitch stepansergeevitch deleted the FIR-43722-add-streaming-to-python-sdk branch April 18, 2025 09:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants