-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
🚨 🚨 Source Stripe: fix multiple issues regarding Refunds, CheckoutSessions and CheckoutSessionsLineItems + fix stream schemas #32286
🚨 🚨 Source Stripe: fix multiple issues regarding Refunds, CheckoutSessions and CheckoutSessionsLineItems + fix stream schemas #32286
Conversation
… github.com:airbytehq/airbyte into ddavydov/source-stripe-fix-default-tax-rates-schema
…ddavydov/3398-oncall-bugfix
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Ignored Deployment
|
Before Merging a Connector Pull RequestWow! What a great pull request you have here! 🎉 To merge this PR, ensure the following has been done/considered for each connector added or updated:
If the checklist is complete, but the CI check is failing,
|
Hey Denys! To speed up the review process, can you describe in which cases could these cases occur?
|
We don't know the reason but the Stripe API does not return events of types
Yes, we would lose sessions that would be created between the time of the sync and the most recent
First of all, having changed the parent stream's legacy cursor field, we need to change this stream's cursor field as well -- this is how we prevent the data loss. Also, we're not moving to using |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those changes LGTM. Thanks for providing more information and testing exhaustively.
I would like us to take actions on what you mentioned We don't know the reason but the Stripe API does not return events of types refund.* and this is not a transient issue
:
- Can we document this in our code? It feels weird that this stream does not leverage the Events API and it feels like it deserve an explanation
- Can we open a ticket with Stripe to see why the refunds event would not work? Based on their documentation, it should and it feels like we could get more information on this API that might affect other streams we have
Once both are done and my comments are addressed, I'll approve the PR
airbyte-integrations/connectors/source-stripe/unit_tests/test_streams.py
Show resolved
Hide resolved
…github.com:airbytehq/airbyte into ddavydov/3428-source-stripe-fix-incremental-issues
@maxi297 the complaint to Stripe has been filed. I do not have any link, however I think they should reply in an email shortly. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks Denys
…to ddavydov/3428-source-stripe-fix-incremental-issues
…github.com:airbytehq/airbyte into ddavydov/3428-source-stripe-fix-incremental-issues
@katmarkham a kind reminder to review this PR |
@@ -33,6 +33,14 @@ data: | |||
schema refresh of all effected streams is required to use the new cursor | |||
format. | |||
upgradeDeadline: "2023-09-14" | |||
5.0.0: | |||
message: | |||
Version 5.0.0 introduces fixes for the `CheckoutSessions`, `CheckoutSessionsLineItems` and `Refunds` streams. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Version 5.0.0 introduces fixes for the CheckoutSessions
, CheckoutSessionsLineItems
and Refunds
streams. The cursor field is changed for the CheckoutSessionsLineItems
and Refunds
streams. This will prevent data loss during incremental syncs.
Also, the Invoices
, Subscriptions
and SubscriptionSchedule
stream schemas have been updated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
applied
], | ||
**args, | ||
), | ||
# The refunds stream does not utilize the Events API as we faced issues with data loss during the incremental syncs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# The Refunds stream does not utilize the Events API as it created issues with data loss during the incremental syncs.
# Therefore, we're using the regular API with the `created` cursor field. A bug has been filed with Stripe.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
applied
after creation. Applies only to streams that do not support event-based incremental syncs: CheckoutSessionLineItems, | ||
Events, SetupAttempts, ShippingRates, BalanceTransactions, Files, FileLinks. More info <a | ||
after creation. Applies only to streams that do not support event-based incremental syncs: Events, | ||
SetupAttempts, ShippingRates, BalanceTransactions, Files, FileLinks, Refunds. More info <a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Lookback Window only applies to streams that do not support event-based incremental syncs: Events,
SetupAttempts, ShippingRates, BalanceTransactions, Files, FileLinks, Refunds.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
applied
|
||
class ParentIncrementalStipeSubStream(StripeSubStream): | ||
""" | ||
This stream differs from others in that it runs parent stream in exactly same sync mode it is run itself to generate stream slices. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This stream differs from others in that it runs parent stream in exactly same sync mode it is run itself to generate stream slices.
(this is unclear to me, perhaps we can talk live?)
It also uses regular /v1
API endpoints to sync data no matter what the sync mode is. This means that the event-based API may only
be utilized by the parent stream.
(should may be "can"?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion applied: "may" changed to "can". However, this is a docstring, so, cloud users won't even see it, so I don't think this is a significant change
@@ -1,5 +1,19 @@ | |||
# Stripe Migration Guide | |||
|
|||
## Upgrading to 5.0.0 | |||
|
|||
This change fixes multiple issues for the `Refunds`, `Checkout Sessions` and `Checkout Sessions Line Items` streams: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change fixes multiple incremental sync issues with the Refunds
, Checkout Sessions
and Checkout Sessions Line Items
streams:
-
Refunds
stream was not syncing data in the incremental sync mode. Cursor field has been updated to "created" to allow for incremental syncs. Because of the changed cursor field of theRefunds
stream, incremental syncs will not reflect every update of the records that have been previously replicated. Only newly created records will be synced. To always have the up-to-date data, users are encouraged to make use of the lookback window. -
CheckoutSessions
stream had been missing data for one day when using the incremental sync mode after a reset; this has been resolved. -
CheckoutSessionsLineItems
previously had potential data loss. It has been updated to use a new cursor field ___. -
Incremental streams with the
created
cursor had been duplicating some data; this has been fixed.
Stream schema update is a breaking change as well as changing the cursor field for the Refunds
and the CheckoutSessionsLineItems
stream. A schema refresh and data reset of all effected streams is required after the update is applied.
Also, this update affects three more streams: Invoices
, Subscriptions
, SubscriptionSchedule
. Schemas are changed in this update so that the declared data types would match the actual data.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion applied
What
This PR addresses multiple issues described in https://github.com/airbytehq/oncall/issues/3428 that are related to incremental syncs of the
Refunds
,CheckoutSessions
andCheckoutSessionsLineItems
streams + fixes stream schemas:Refunds
missing data in the incremental sync modeCheckoutSessions
missing data for one day after a resetCheckoutSessionLineItems
potential data losscreated
cursor field produce duplicated data in edge casesInvoices
,Subscriptions
,SubscriptionSchedule
streamsHow
Refunds
streamCheckoutSessions
streamCheckoutSessionsLineItems
streamCheckoutSessionsLineItems
streamparent_id
andadd_parent_id
of theStripeLazySubStream
class🚨 User Impact 🚨
CheckoutSessionLineItems
andRefunds
streams will have their cursor fields changed what is reflected in the migration guide