feat(low-code): add UnionPartitionRouter component#1071
feat(low-code): add UnionPartitionRouter component#1071Daryna Ishchenko (darynaishchenko) wants to merge 6 commits into
Conversation
Co-Authored-By: Daryna Ishchenko <darina.ishchenko17@gmail.com>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
👋 Greetings, Airbyte Team Member!Here are some helpful tips and reminders for your convenience. 💡 Show Tips and TricksTesting This CDK VersionYou can test this version of the CDK using the following: # Run the CLI from this branch:
uvx 'git+https://github.com/airbytehq/airbyte-python-cdk.git@devin/1783689479-union-partition-router#egg=airbyte-python-cdk[dev]' --help
# Update a connector to use the CDK from this branch ref:
cd airbyte-integrations/connectors/source-example
poe use-cdk-branch devin/1783689479-union-partition-routerPR Slash CommandsAirbyte Maintainers can execute the following slash commands on your PR:
|
…er additions Co-Authored-By: Daryna Ishchenko <darina.ishchenko17@gmail.com>
PyTest Results (Fast)4 156 tests +29 4 144 ✅ +29 8m 1s ⏱️ +20s Results for commit 36b06ad. ± Comparison against base commit dd9558c. This pull request removes 1 and adds 30 tests. Note that renamed tests count towards both.♻️ This comment has been updated with latest results. |
PyTest Results (Full)4 159 tests +29 4 147 ✅ +29 12m 20s ⏱️ + 5m 5s Results for commit 36b06ad. ± Comparison against base commit dd9558c. This pull request removes 1 and adds 30 tests. Note that renamed tests count towards both.♻️ This comment has been updated with latest results. |
…rip for UnionPartitionRouter Co-Authored-By: Daryna Ishchenko <darina.ishchenko17@gmail.com>
- fail fast at factory time when a built-in child router emits a different partition field
- treat partition_field as a plain string in LegacyToPerPartitionStateMigration to match runtime
- raise a pointed error for unhashable partition values during dedup
- warn on parent stream state key collisions in get_stream_state; return {} instead of None
- widen migration type hints and factory error message to cover accepted router types
Co-Authored-By: Daryna Ishchenko <darina.ishchenko17@gmail.com>
…-motherduck check Co-Authored-By: Daryna Ishchenko <darina.ishchenko17@gmail.com>
|
Caution Review failedAn error occurred during the review process. Please try again later. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…uild time partition_field depends only on config/parameters, so the factory evaluates it once and the runtime component always receives a plain string. This lets config-driven child partition fields work with the union router. The migration special case that skipped interpolation for unions is removed since the model's raw partition_field is now interpolated through the shared eval path. Schema documents the interpolation contract with an interpolated example. Co-Authored-By: Daryna Ishchenko <darina.ishchenko17@gmail.com>
Summary
Adds a new first-class declarative component,
UnionPartitionRouter, to unblock the source-github migration to manifest-only (see https://github.com/airbytehq/airbyte-internal-issues/issues/16492, https://github.com/airbytehq/airbyte-internal-issues/issues/16512 and airbytehq/airbyte#81428). It yields the deduplicated union of its child partition routers' slices, normalized to a single stable partition field:Behavior of
UnionPartitionRouter.stream_slices():partition_fieldvalue wins, later duplicates are skipped.{partition_field: value}; any other partition keys from a child (e.g.SubstreamPartitionRouter'sparent_slice) are moved intoextra_fields, so per-partition state keys stay stable regardless of which child produced the slice.get_stream_state()merges children's parent-stream states; request option methods return{}(children declaringrequest_optionare rejected at factory time — consume partition values viastream_partitioninterpolation instead). Note:CustomPartitionRouterchildren are opaque, so the request-option rejection cannot cover them.Wiring beyond the runtime class and schema:
create_union_partition_routerinModelToComponentFactory, registered inPYDANTIC_MODEL_TO_CONSTRUCTOR; schema registered inSimpleRetriever/AsyncRetrieverpartition_routeranyOf, with self-nesting allowed (minItems: 2).LegacyToPerPartitionStateMigrationacceptsUnionPartitionRouter:_get_partition_fieldreadspartition_fielddirectly, and the single-parent-stream check inshould_migratedoesn't apply.use_cacheauto-enable (_initialize_cache_for_parent_streams) and parent/ancestor dependency-graph collection (_collect_all_parent_stream_names,_collect_all_ancestor_names) now recurse into composed routers (partition_routers/underlying_partition_router).Tests:
use_cacheforce-enabled on all parents referenced through a union (including nested parent stream instances), and parent/ancestor collection detects deadlocks throughUnionPartitionRouterchildren, incl. a union nested insideGroupingPartitionRouter.Note on generated models:
poetry run poe assembleproduces the same ~350-line style drift (conint/confloat, class reordering) on a cleanmaincheckout in this environment, sodeclarative_component_schema.pywas hand-patched with only the UnionPartitionRouter additions to preserve the committed generated style.Link to Devin session: https://app.devin.ai/sessions/38753ed2d1f346e6a370888444676f4f
Requested by: Daryna Ishchenko (@darynaishchenko)