Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Resolve issue where PyAirbyte would fail if property names contain the dot character ('.'), e.g. with source-google-ads #343

Merged
merged 21 commits into from
Sep 7, 2024

Conversation

sukantaroy01
Copy link
Contributor

@sukantaroy01 sukantaroy01 commented Aug 20, 2024

Fixes: #181

During a proof of concept (POC) with the Google Ads source, I encountered an issue where primary keys containing periods (e.g., campaign.id, adset.id) were not being correctly handled. The root cause was that get_primary_keys did not normalize column names before checking for nested keys.

To address this, I implemented normalization of primary keys prior to the nested key check. This resolved the issue, allowing successful data collection from the Google Ads platform.

Summary by CodeRabbit

  • New Features
    • Enhanced primary key processing by introducing normalization for consistency and compatibility.
    • Added support for a new stream type with a primary key containing a dot, expanding integration capabilities.
  • Bug Fixes
    • Improved validation for primary keys to prevent inconsistencies related to case sensitivity.
  • Chores
    • Updated the .gitignore file to exclude PyCharm project files for a cleaner repository.

Copy link

coderabbitai bot commented Aug 20, 2024

Walkthrough

Walkthrough

The recent changes introduce a normalization step for primary keys in the get_primary_keys function, ensuring consistent formatting of primary key components before concatenation. Additionally, a new stream configuration and sample record are added to support a stream with a primary key containing a dot, which aligns with the structure used in Google Ads. The .gitignore file is also updated to exclude PyCharm project files.

Changes

Files Change Summary
.gitignore Added .idea directory to be ignored.
airbyte/shared/catalog_providers.py Added normalization for primary keys in the get_primary_keys function.
tests/integration_tests/fixtures/source-test/source_test/run.py Introduced a new stream configuration and sample record for a stream with a primary key containing a dot.
tests/unit_tests/test_text_normalization.py Added a new test case to cover normalization behavior with special characters.

Assessment against linked issues

Objective Addressed Explanation
Resolve Google Ads failure due to nested primary keys (#181)

Would you like to add more details to the Walkthrough or Changes sections, or do you think they capture everything needed?


Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 98066cd and 0e0a22c.

Files selected for processing (3)
  • airbyte/shared/catalog_providers.py (2 hunks)
  • tests/integration_tests/fixtures/source-test/source_test/run.py (3 hunks)
  • tests/unit_tests/test_text_normalization.py (1 hunks)
Files skipped from review as they are similar to previous changes (2)
  • airbyte/shared/catalog_providers.py
  • tests/integration_tests/fixtures/source-test/source_test/run.py

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 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 or @coderabbitai title 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.

@sukantaroy01
Copy link
Contributor Author

@aaronsteers Can you please look into this PR once you have some bandwidth?

@aaronsteers
Copy link
Contributor

aaronsteers commented Aug 31, 2024

/test-pr

PR test job started... Check job output.

❌ Tests failed.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Outside diff range, codebase verification and nitpick comments (1)
airbyte/shared/catalog_providers.py (1)

153-154: Normalization step for primary keys

The changes introduce a normalization step using LowerCaseNormalizer to ensure that primary key components are consistently formatted before concatenation. This is a good addition as it can prevent issues related to case sensitivity when comparing keys. 👍

Just a thought - are there any other normalization steps that might be needed for primary keys in your use case? For example, removing special characters or whitespace. Wdyt?

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

@Udit107710
Copy link
Contributor

/test-pr

@aaronsteers
Copy link
Contributor

@Udit107710 and @sukantaroy01 - Thanks for your work on this. Do you have the ability to enable commits from maintainers/reviewers? (Looks like it is not enabled as of now.)

@aaronsteers
Copy link
Contributor

Opened second PR targeting this one:

@aaronsteers aaronsteers mentioned this pull request Sep 4, 2024
@Udit107710
Copy link
Contributor

Thanks @aaronsteers Merged your PR!

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

tests/unit_tests/test_text_normalization.py Show resolved Hide resolved
@aaronsteers
Copy link
Contributor

@sukantaroy01 - This looks good and I really appreciate your investment here. When I ran on the other PR, there were still some failing tests, mostly related to listing the stream names in the source-test fixture, and similar trivial changes that broke existing tests.

That said, this PR can't accept my contributions so I will go ahead and merge, to resolve the small test failures in a subsequent PR which I can tackle fairly quickly.

Thanks very much for contributing to PyAirbyte! 🎉 ❤️

Copy link
Contributor

@aaronsteers aaronsteers left a comment

Choose a reason for hiding this comment

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

Amazing work here. Thanks so much! ✅

@aaronsteers aaronsteers changed the title Fix: Google Ads fails due to nested primary keys Fix: Resolve issue where PyAirbyte would fail if property names contain the dot character ('.'), e.g. with source-google-ads Sep 7, 2024
@aaronsteers aaronsteers merged commit 826d689 into airbytehq:main Sep 7, 2024
10 checks passed
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.

🐛 Bug: Google Ads fails due to nested primary keys
4 participants