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

Feat: Add experimental support for low-code source execution via manifest YAML #175

Merged
merged 38 commits into from
Jun 4, 2024

Conversation

aaronsteers
Copy link
Contributor

@aaronsteers aaronsteers commented Apr 7, 2024

This adds the ability to run (in theory) 130 declarative yaml sources in PyAirbyte, without any need for additional virtual environment isolation. The manifest.yml file content can be provided by the user or auto-downloaded from master branch of airbytehq/airbyte.

Thanks to @bnchrch and @lmossman for helping figure out the logic.

The get_source() implementation in airbyte.experimental includes a new source_manifest input argument.

The argument can be any of these types:

The Yaml-runnable connectors can be found using ab.get_available_connectors(install_type="yaml") or ab.get_available_connectors(InstallType.YAML)

This PR also adds hard-coded exclusions for connectors in three categories:

  • Low-code connectors that require additional python files.
  • Low-code connectors that fail validation.
  • Low-code connector (just 1) that currently hits a 404.

Usage example

See the 2 new scripts in the examples directory for more examples, but the simplest usage is just:

from airbyte.experimental import get_source

source = get_source(
    "source-pokeapi",
    config={
        "pokemon_name": "ditto",
    },
    source_manifest=True,
)
source.check()
source.select_all_streams()

result = source.read()

In the above example, the source manifest.yml is automatically located from master branch of airbytehq/airbyte, and the only change from the user perspective is to add the arg source_manifest=True.

Note

  • In a future iteration, when we are more comfortable with this execution mode, we may just make this the default, and then a pip-based install would require user opt-in.

Included Connectors

This is the result of calling get_available_connectors("yaml"):

Show/Hide

- source-activecampaign
- source-aha
- source-aircall
- source-appfollow
- source-apple-search-ads
- source-ashby
- source-auth0
- source-babelforce
- source-breezometer
- source-callrail
- source-captain-data
- source-chargify
- source-chartmogul
- source-clickup-api
- source-clockify
- source-coda
- source-coin-api
- source-coingecko-coins
- source-coinmarketcap
- source-configcat
- source-confluence
- source-convertkit
- source-copper
- source-datadog
- source-datascope
- source-delighted
- source-dixa
- source-dockerhub
- source-dremio
- source-drift
- source-emailoctopus
- source-exchange-rates
- source-flexport
- source-freshcaller
- source-freshsales
- source-freshservice
- source-fullstory
- source-gainsight-px
- source-getlago
- source-glassfrog
- source-gocardless
- source-gong
- source-google-pagespeed-insights
- source-google-webfonts
- source-gutendex
- source-harvest
- source-hellobaton
- source-hubplanner
- source-insightly
- source-intruder
- source-ip2whois
- source-k6-cloud
- source-klarna
- source-klaus-api
- source-launchdarkly
- source-lemlist
- source-lever-hiring
- source-lokalise
- source-mailerlite
- source-mailersend
- source-mailgun
- source-mailjet-mail
- source-mailjet-sms
- source-marketo
- source-merge
- source-metabase
- source-microsoft-teams
- source-n8n
- source-nasa
- source-news-api
- source-newsdata
- source-nytimes
- source-omnisend
- source-onesignal
- source-open-exchange-rates
- source-openweather
- source-opsgenie
- source-orbit
- source-oura
- source-pendo
- source-persistiq
- source-pexels-api
- source-pivotal-tracker
- source-plaid
- source-plausible
- source-pokeapi
- source-polygon-stock-api
- source-postmarkapp
- source-primetric
- source-punk-api
- source-pypi
- source-recreation
- source-recruitee
- source-reply-io
- source-ringcentral
- source-rocket-chat
- source-sap-fieldglass
- source-secoda
- source-sendgrid
- source-sendinblue
- source-sentry
- source-serpstat
- source-smartengage
- source-sonar-cloud
- source-spacex-api
- source-square
- source-statuspage
- source-strava
- source-survey-sparrow
- source-tempo
- source-timely
- source-tmdb
- source-todoist
- source-toggl
- source-tvmaze-schedule
- source-twilio-taskrouter
- source-twitter
- source-tyntec-sms
- source-visma-economic
- source-vitally
- source-waiteraid
- source-whisky-hunter
- source-wikipedia-pageviews
- source-workable
- source-workramp
- source-wrike
- source-yahoo-finance-price
- source-yotpo
- source-zapier-supported-storage
- source-zenefits

Hard-coded exclusions have been removed from this list, for instance, those low-code connectors that require one or more python code files.

Summary by CodeRabbit

  • New Features

    • Introduced declarative YAML source testing in Airbyte.
    • Added support for installing connectors from a YAML manifest.
  • Enhancements

    • Updated ConnectorMetadata to include language and installation types.
    • Improved get_available_connectors to handle different installation types.
  • Dependencies

    • Updated airbyte-cdk to ^1.2.1.
    • Updated airbyte-source-faker to ^6.1.2.
  • Tests

    • Added new integration and unit tests for low-code connectors.
    • Enhanced test fixtures to mock registry behavior and handle source testing.

pyproject.toml Outdated Show resolved Hide resolved
@aaronsteers aaronsteers changed the title [Do not merge]: Skeleton of native declarative source support ⛔️ [Do not merge]: Skeleton of native declarative source support May 23, 2024
@aaronsteers aaronsteers changed the title ⛔️ [Do not merge]: Skeleton of native declarative source support ⏱️ [Do not merge]: Skeleton of native declarative source support May 23, 2024
@aaronsteers aaronsteers changed the title ⏱️ [Do not merge]: Skeleton of native declarative source support Feat: Add native support for declarative source manifest YAMLs May 30, 2024
@aaronsteers aaronsteers marked this pull request as ready for review June 1, 2024 00:17
@aaronsteers
Copy link
Contributor Author

@natikgadzhi, @erohmensing, @bindipankhudi, @alafanechere, @bnchrch - This is ready for your review.

Tests are all passing except Python 3.11 tests, which will be resolved soon via @natikgadzhi's CDK update here (just merged, pending release to PyPi): airbytehq/airbyte#38846

@aaronsteers
Copy link
Contributor Author

aaronsteers commented Jun 3, 2024

/fix-pr

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

✅ Changes applied successfully.

Copy link

coderabbitai bot commented Jun 3, 2024

Walkthrough

The recent updates to the Airbyte module introduce new entities and functionalities, enhance existing modules, and add support for declarative YAML source testing. Key changes include adding the records entity, importing snowflakecortex, and integrating a base module in the caches. The sources have been significantly updated with new classes and methods for handling declarative sources. Additionally, new example files and updated tests ensure robust handling of connectors and sources.

Changes

Files Change Summaries
airbyte/__init__.py Added records entity; replaced experimental with records.
airbyte/_processors/sql/__init__.py Added import statement for snowflakecortex.
airbyte/caches/__init__.py Added import statement for base module.
airbyte/sources/declarative.py Introduced classes DeclarativeExecutor and DeclarativeSource for YAML sources.
airbyte/sources/registry.py Added imports, constants, Enums, attributes, and updated functions for connectors.
airbyte/sources/util.py Added imports, parameters, and logic for handling YAML manifest in _get_source.
examples/... Added run_declarative_manifest_source.py and run_downloadable_yaml_source.py.
pyproject.toml Updated dependency versions for airbyte-cdk and airbyte-source-faker.
tests/conftest.py Added imports, modified fixtures, and mocked registry behavior for testing.
tests/integration_tests/... Added and modified test functions for connectors and sources.
tests/unit_tests/... Added and modified test functions and fixtures for unit testing connectors.

Sequence Diagram(s) (Beta)

sequenceDiagram
    participant User
    participant Airbyte
    participant DeclarativeExecutor
    participant Source

    User->>Airbyte: Run declarative manifest source
    Airbyte->>DeclarativeExecutor: Initialize with manifest
    DeclarativeExecutor->>Source: Execute source with manifest
    Source-->>DeclarativeExecutor: Return data
    DeclarativeExecutor-->>Airbyte: Processed data
    Airbyte-->>User: Display data
Loading

Poem

In the realm of Airbyte's code,
New records and sources showed,
YAML manifests now take flight,
Bringing data to the light.
With tests and imports all aligned,
A seamless flow you'll surely find.
🐇✨


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:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • 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 as 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.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration 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.

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: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 6210103 and 8b09522.

Files ignored due to path filters (1)
  • poetry.lock is excluded by !**/*.lock
Files selected for processing (14)
  • airbyte/init.py (1 hunks)
  • airbyte/_processors/sql/init.py (1 hunks)
  • airbyte/caches/init.py (1 hunks)
  • airbyte/sources/declarative.py (1 hunks)
  • airbyte/sources/registry.py (5 hunks)
  • airbyte/sources/util.py (4 hunks)
  • examples/run_declarative_manifest_source.py (1 hunks)
  • examples/run_downloadable_yaml_source.py (1 hunks)
  • pyproject.toml (2 hunks)
  • tests/conftest.py (2 hunks)
  • tests/integration_tests/test_lowcode_connectors.py (1 hunks)
  • tests/integration_tests/test_source_test_fixture.py (3 hunks)
  • tests/unit_tests/test_anonymous_usage_stats.py (2 hunks)
  • tests/unit_tests/test_lowcode_connectors.py (1 hunks)
Files not reviewed due to errors (4)
  • airbyte/sources/registry.py (no review received)
  • tests/conftest.py (no review received)
  • pyproject.toml (no review received)
  • airbyte/sources/util.py (no review received)
Files skipped from review due to trivial changes (2)
  • airbyte/caches/init.py
  • examples/run_declarative_manifest_source.py
Additional comments not posted (16)
airbyte/_processors/sql/__init__.py (2)

6-6: The import of snowflakecortex aligns with the PR's enhancements to SQL processing capabilities.


Line range hint 6-12: The updated export list correctly exposes the new SnowflakeCortexSqlProcessor and SnowflakeCortexTypeConverter, ensuring they are accessible as intended.

tests/unit_tests/test_lowcode_connectors.py (2)

13-31: The parameterized test setup for low-code connectors is well-implemented, ensuring comprehensive testing across different configurations.


20-31: The test execution logic is correctly implemented, using the get_source function with the source_manifest parameter to handle YAML sources as intended in the PR.

airbyte/__init__.py (1)

19-19: The addition of records to the module's exports is appropriate and aligns with the PR's enhancements to the module's capabilities.

examples/run_downloadable_yaml_source.py (2)

15-53: The example script effectively demonstrates the retrieval and usage of YAML connectors, aligning with the PR's objective to support declarative sources.


21-37: The error handling in the script is robust, effectively capturing and reporting failures during the installation of YAML connectors, which enhances the script's reliability.

tests/integration_tests/test_lowcode_connectors.py (2)

20-38: The test setup for connector initialization is comprehensive and well-implemented, ensuring each connector's ability to initialize is thoroughly tested.


41-78: The test setup for handling expected failures is well-structured and effectively uses parameterization to test different failure scenarios, enhancing the robustness of the testing process.

airbyte/sources/declarative.py (2)

22-69: The DeclarativeExecutor class is well-designed, effectively handling different types of manifest inputs and providing clear error messages, which enhances its usability and robustness.


72-104: The DeclarativeSource class is appropriately implemented, providing detailed documentation and examples for usage, which aids in understanding and utilizing the class effectively.

tests/unit_tests/test_anonymous_usage_stats.py (3)

15-18: LGTM! Proper use of fixture scope and cleanup.


21-21: LGTM! Telemetry tracking functionality is correctly tested.


75-79: LGTM! Correct handling of the DO_NOT_TRACK environment variable.

tests/integration_tests/test_source_test_fixture.py (2)

221-222: The addition of language and install_types parameters enhances the function's flexibility and aligns with the new features introduced in the PR.


30-33: Ensure the autouse_source_test_registry fixture is correctly utilized.

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: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 8b09522 and 3cdaf7e.

Files selected for processing (1)
  • airbyte/sources/util.py (4 hunks)
Files skipped from review as they are similar to previous changes (1)
  • airbyte/sources/util.py

@aaronsteers aaronsteers merged commit 4de5793 into main Jun 4, 2024
16 checks passed
@aaronsteers aaronsteers deleted the aj/feat/source-declarative-manifest branch June 4, 2024 02:37
@aaronsteers aaronsteers changed the title Feat: Add native support for declarative source manifest YAMLs Feat: Add experimental support for low-code source execution via manifest YAML Jun 4, 2024
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.

2 participants