Skip to content

Conversation

lazebnyi
Copy link
Contributor

@lazebnyi lazebnyi commented Mar 12, 2025

Fixed: https://github.com/airbytehq/airbyte-internal-issues/issues/11933

Summary by CodeRabbit

  • New Features
    • Added a configurable option that lets users choose to apply data transformations before filtering records, providing enhanced control over the data processing order.

@Copilot Copilot AI review requested due to automatic review settings March 12, 2025 16:05
@lazebnyi
Copy link
Contributor Author

lazebnyi commented Mar 12, 2025

/autofix

Auto-Fix Job Info

This job attempts to auto-fix any linting or formating issues. If any fixes are made,
those changes will be automatically committed and pushed back to the PR.

Note: This job can only be run by maintainers. On PRs from forks, this command requires
that the PR author has enabled the Allow edits from maintainers option.

PR auto-fix job started... Check job output.

✅ Changes applied successfully.

@github-actions github-actions bot added the enhancement New feature or request label Mar 12, 2025
Copy link
Contributor

coderabbitai bot commented Mar 12, 2025

📝 Walkthrough

Walkthrough

This pull request adds a new optional property, transform_before_filtering, to the RecordSelector configuration. In the YAML schema and Python model, the field is defined as a boolean (defaulting to false) to specify whether record transformations should occur before filtering. Additionally, the create_record_selector method in the component factory has been updated to assert that this field is set in the model and to pass its value accordingly.

Changes

File(s) Change Summary
airbyte_cdk/.../declarative_component_schema.yaml
airbyte_cdk/.../declarative_component_schema.py
Added new property/field transform_before_filtering (boolean, default false) to the RecordSelector definition in both the schema and Python model.
airbyte_cdk/.../model_to_component_factory.py Modified the create_record_selector method by removing the default assignment of False and adding an assertion for model.transform_before_filtering before use.

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant Factory as ModelToComponentFactory
  participant Selector as RecordSelector

  Client->>Factory: create_record_selector(model, config)
  Factory->>Factory: Assert model.transform_before_filtering is not None
  Factory->>Selector: Initialize RecordSelector with transform_before_filtering flag
  Selector-->>Factory: Return configured RecordSelector
  Factory-->>Client: Return RecordSelector
Loading

Possibly related PRs

Suggested reviewers

  • darynaishchenko - wdyt?
  • aldogonzalez8 - wdyt?
  • maxi297 - wdyt?

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 741a2a0 and 26e953f.

📒 Files selected for processing (3)
  • airbyte_cdk/sources/declarative/declarative_component_schema.yaml (1 hunks)
  • airbyte_cdk/sources/declarative/models/declarative_component_schema.py (1 hunks)
  • airbyte_cdk/sources/declarative/parsers/model_to_component_factory.py (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (8)
  • GitHub Check: Check: 'source-pokeapi' (skip=false)
  • GitHub Check: Check: 'source-amplitude' (skip=false)
  • GitHub Check: Check: 'source-shopify' (skip=false)
  • GitHub Check: Check: 'source-hardcoded-records' (skip=false)
  • GitHub Check: Pytest (All, Python 3.11, Ubuntu)
  • GitHub Check: Pytest (All, Python 3.10, Ubuntu)
  • GitHub Check: Pytest (Fast)
  • GitHub Check: SDM Docker Image Build
🔇 Additional comments (3)
airbyte_cdk/sources/declarative/models/declarative_component_schema.py (1)

1774-1777: LGTM! Have you considered adding more detailed documentation for edge cases?

The addition of the transform_before_filtering field to the RecordSelector class looks good. This enables controlling whether transformations are applied before record filtering, which can be useful in scenarios where you want to transform data before applying filtering logic.

The default value of False maintains backward compatibility with existing implementations. The field type and description are clear and appropriate.

Just curious - are there any specific edge cases or performance implications users should be aware of when setting this to True? Might be worth elaborating in the description or adding a comment in the documentation, wdyt?

airbyte_cdk/sources/declarative/declarative_component_schema.yaml (1)

2986-2989: New Field transform_before_filtering in RecordSelector

You've added a clear and well-documented boolean property with a default of false. This aligns neatly with the PR’s objective, allowing the transformation to happen before filtering when enabled. Could you please confirm that downstream components correctly interpret and apply this flag consistently? wdyt?

airbyte_cdk/sources/declarative/parsers/model_to_component_factory.py (1)

2567-2569: Looks good, but do we need to enforce non-None for mypy explicitly?

The assertion ensures model.transform_before_filtering is not None (for mypy type checking), followed by direct assignment to the variable. This change aligns with adding the new transform_before_filtering option to control transformation order.

Just curious: since this property should have a default value in the schema definition, is the assertion truly necessary? If the schema guarantees a default, we could potentially simplify. But if it's needed for complete type safety, then it makes sense - wdyt?

✨ Finishing Touches
  • 📝 Generate Docstrings

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

‼️ IMPORTANT
Auto-reply has been disabled for this repository in the CodeRabbit settings. The CodeRabbit bot will not respond to your replies unless it is explicitly tagged.

  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@lazebnyi lazebnyi requested review from bazarnov and maxi297 March 13, 2025 19:58
Copy link
Contributor

@bazarnov bazarnov left a comment

Choose a reason for hiding this comment

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

Looks good to me, feel free to ignore the comments if it's blocking you in certain ways.

@lazebnyi lazebnyi merged commit b69bdbd into main Mar 13, 2025
26 checks passed
@lazebnyi lazebnyi deleted the lazebnyi/add-transform-before-filtering branch March 13, 2025 22:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants