Repository navigation
[Python] Add stream_builder() - #1116
Closed
dimitrije-djordjevic-db wants to merge 1 commit into
Closed
dimitrije-djordjevic-db wants to merge 1 commit into
dimitrije-djordjevic-db wants to merge 1 commit into
Conversation
Add ZerobusSdk.stream_builder() to the sync and async SDKs, mirroring the Rust SDK's stream_builder(): set the table, OAuth or a custom headers provider, the JSON, protobuf, or Avro format, and stream settings, then call build() for a ZerobusStream. create_stream() is unchanged and remains the way to use external-IdP federation. The setters it shares with the persistent stream builder move into a common base class; the persistent builder's behavior and error messages are unchanged. Co-authored-by: Isaac <no-reply@databricks.com> Signed-off-by: Dimitrije Đorđević <dimitrije.djordjevic@databricks.com>
This was referenced Nov 17, 2026
Contributor
Author
This was referenced Nov 27, 2026
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.
Stack
What changes are proposed in this pull request?
This PR adds
ZerobusSdk.stream_builder()to the sync (zerobus.sdk.sync) and async (zerobus.sdk.aio) SDKs, mirroring the Rust SDK'sstream_builder(). You set the table, the authentication (oauth(...)orheaders_provider(...)), the record format (json(),compiled_proto(...), oravro(...)), and the stream settings, then callbuild(). It returns the sameZerobusStreamascreate_stream(), which does not change.Why: a builder keeps optional settings out of positional arguments and matches the Rust and Java SDKs. It is also the entry point for multiplexed streams, which the next PR in this stack adds as
stream_builder()...multiplexed(n).StreamSettingsobject. Settings left unset are never forwarded, so the Rust core keeps its own defaults.ValueErrorbefore anything is opened. The last auth setter and the last format setter win.create_stream(auth=...)for now; a later PR in this stack adds it to the builder.zerobus/sdk/shared/persistent.py, which this PR refactors; whichever merges second rebases onto the other.Related: #163
How is this tested?
tests/test_stream_builder.py(runs in CI, no server): required settings, last-setter-wins for auth and format, setter input checks, a complete configuration for each record format reaching the native layer (an unreachable endpoint fails only after validation), the native layer's own one-auth-method check, and the public surface, in sync and async mode.This pull request and its description were written by Isaac.