-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[dagster-airbyte] Support
client_id
and client_secret
in AirbyteC…
…loudResource (#23451) ## Summary & Motivation This PR updates the `AirbyteCloudResource` to support `client_id` and `client_secret` for authentication. The `api_key` can no longer be used for authentication because Airbyte is [deprecating portal.airbyte.com](https://reference.airbyte.com/reference/portalairbytecom-deprecation). Tests and docs are updated to reflect the changes. Two main questions for reviewers: - this PR implements a pattern where the access token is refreshed before making a call to the API, if the token was fetched more than 2.5 minutes ago. Should we avoid this pattern and let users manage the resource lifecycle? - [According to Airbyte](https://reference.airbyte.com/reference/portalairbytecom-deprecation), the access token expires after 3 minutes. - The access token is initially fetched in `setup_for_execution`, then refreshed if needed. I'm concerned that for jobs including other assets, it might take more than 3 minutes before the Airbyte assets are materialized. - [portal.airbyte.com will be deprecated next week](https://reference.airbyte.com/reference/portalairbytecom-deprecation), on August 15th, so I removed the previous `api_key` attribute without deprecation warning. Are we comfortable doing so? Considering that this approach will fail next week. ## How I Tested These Changes BK with updated tests Fully tested on a live cloud instance with this code: ```python from dagster import Definitions, EnvVar from dagster_airbyte import AirbyteCloudResource, build_airbyte_assets airbyte_instance = AirbyteCloudResource( client_id=EnvVar("AIRBYTE_CLIENT_ID"), client_secret=EnvVar("AIRBYTE_CLIENT_SECRET"), ) airbyte_assets = build_airbyte_assets( # Test connection - Sample Data (Faker) to Google Sheets connection_id="0bb7a00c-0b85-4fac-b8ff-67dc380f1c29", destination_tables=["products", "purchases", "users"], ) defs = Definitions(assets=airbyte_assets, resources={"airbyte": airbyte_instance}) ``` Job successful: <img width="1037" alt="Screenshot 2024-08-13 at 4 30 12 PM" src="https://github.com/user-attachments/assets/46c91c95-b597-48de-bcbd-8bbb38f5f6d4"> Asset graph: <img width="1037" alt="Screenshot 2024-08-13 at 4 30 38 PM" src="https://github.com/user-attachments/assets/eae8ab12-0da9-4956-8ae6-10932cd0c199">
- Loading branch information
1 parent
438c389
commit 89b9999
Showing
7 changed files
with
235 additions
and
31 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.