feat: add ClientSideIncrementalRetrieverDecorator for custom retrievers#893
Draft
darynaishchenko wants to merge 2 commits intomainfrom
Draft
feat: add ClientSideIncrementalRetrieverDecorator for custom retrievers#893darynaishchenko wants to merge 2 commits intomainfrom
darynaishchenko wants to merge 2 commits intomainfrom
Conversation
This change automatically applies client-side incremental filtering to custom retrievers when is_client_side_incremental is enabled in the manifest. Previously, custom retrievers bypassed the ClientSideIncrementalRecordFilterDecorator that SimpleRetriever uses, causing all records to be emitted on every sync even when client_side_incremental was configured. Changes: - Add ClientSideIncrementalRetrieverDecorator class that wraps any Retriever and filters records using cursor.should_be_synced() - Update model_to_component_factory.create_default_stream() to wrap custom retrievers with the decorator when is_client_side_incremental is enabled - Add unit tests for the new decorator Co-Authored-By: Daryna Ishchenko <darina.ishchenko17@gmail.com>
Contributor
🤖 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/1770312809-client-side-incremental-custom-retriever#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/1770312809-client-side-incremental-custom-retrieverPR Slash CommandsAirbyte Maintainers can execute the following slash commands on your PR:
|
Co-Authored-By: Daryna Ishchenko <darina.ishchenko17@gmail.com>
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.
Summary
Fixes a gap where custom retrievers bypass client-side incremental filtering even when
is_client_side_incremental: trueis configured in the manifest.Problem: When a stream uses a custom retriever (not
SimpleRetriever), theClientSideIncrementalRecordFilterDecoratorthat normally filters records based on cursor state is never applied. This causes all records to be emitted on every sync, defeating the purpose of incremental syncing.Solution: Add a new
ClientSideIncrementalRetrieverDecoratorthat wraps custom retrievers at the retriever level (rather than record filter level) and applies the same filtering logic usingcursor.should_be_synced().Changes:
ClientSideIncrementalRetrieverDecoratorclass inretrievers/create_default_stream()inmodel_to_component_factory.pyto wrap custom retrievers when:is_client_side_incrementalis enabledSimpleRetriever(which already handles this via record filter)FinalStateCursor(i.e., there's actual incremental state)Related to: airbytehq/oncall#11113
Review & Testing Checklist for Human
elifbranch increate_default_stream()correctly excludesAsyncRetriever(handled in theifbranch above) andSimpleRetriever(already has filtering)is_client_side_incremental: trueto verify end-to-end behaviorMappingis received, aRecordis created withstream_name=""- verify this doesn't cause issues with cursor implementationsNotes