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(source-stripe): ref stream Payment Methods #44891

Merged

Conversation

artem1205
Copy link
Collaborator

@artem1205 artem1205 commented Aug 29, 2024

What

Resolve https://github.com/airbytehq/product-request-backlog/issues/234

How

  • ref stream Payment Methods
  • bump CDK to v5

Review guide

  1. airbyte-integrations/connectors/source-stripe/source_stripe/source.py
  2. airbyte-integrations/connectors/source-stripe/source_stripe/schemas/payment_methods.json

User Impact

Breaking change due to schema changes in customer field: "object" -> "string"

Can this PR be safely reverted and rolled back?

  • YES 💚
  • NO ❌

[no ci]

Signed-off-by: Artem Inzhyyants <artem.inzhyyants@gmail.com>
@artem1205 artem1205 self-assigned this Aug 29, 2024
Copy link

vercel bot commented Aug 29, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
airbyte-docs ⬜️ Ignored (Inspect) Visit Preview Sep 11, 2024 11:45am

Signed-off-by: Artem Inzhyyants <artem.inzhyyants@gmail.com>
Signed-off-by: Artem Inzhyyants <artem.inzhyyants@gmail.com>
Signed-off-by: Artem Inzhyyants <artem.inzhyyants@gmail.com>
Signed-off-by: Artem Inzhyyants <artem.inzhyyants@gmail.com>
@octavia-squidington-iii octavia-squidington-iii added the area/documentation Improvements or additions to documentation label Aug 29, 2024
Signed-off-by: Artem Inzhyyants <artem.inzhyyants@gmail.com>
@artem1205 artem1205 marked this pull request as ready for review August 29, 2024 18:48
@artem1205 artem1205 requested a review from a team August 29, 2024 19:32
{
"type": "STREAM",
"stream": {
"stream_state": { "customer_updated": 10000000000 },
Copy link
Contributor

Choose a reason for hiding this comment

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

Should the state be per partition here? It seems like we are at risk of losing records if it's not

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Should the state be per partition here?

I don't think so because ParentIncrementalStipeSubStream class is used here. Thus, Customers are being synced incrementally and we'll get payment_methods only for the updated ones.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh! So we have validated that when a payment method is updated, the client updated field is also updated. Can we document this somewhere?

Copy link
Contributor

Choose a reason for hiding this comment

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

Also for the incremental part, shouldn't we rely on payment_method.* events instead? https://docs.stripe.com/api/events/types#event_types-payment_method.attached

Copy link
Contributor

Choose a reason for hiding this comment

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

if we did validate the assumption, can it be documented in the code so we have a reference? else we'll assume we're at risk of losing records

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

So we have validated that when a payment method is updated, the client updated field is also updated.

Tested this, customer is NOT being updated on payment_method update.

Also for the incremental part, shouldn't we rely on payment_method.* events instead?

Agreed, we should use this.

Moving PR to draft, need to change the implementation:
1st sync/Full refresh -- read from customers/{customer_id}/payment_methods
2nd sync/Incremental -- read from events stream with type = payment_method.*

Signed-off-by: Artem Inzhyyants <artem.inzhyyants@gmail.com>
{
"type": "STREAM",
"stream": {
"stream_state": { "customer_updated": 10000000000 },
Copy link
Contributor

Choose a reason for hiding this comment

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

if we did validate the assumption, can it be documented in the code so we have a reference? else we'll assume we're at risk of losing records

@@ -483,6 +483,18 @@ def streams(self, config: MutableMapping[str, Any]) -> List[Stream]:
sub_items_attr="refunds",
**args,
),
ParentIncrementalStipeSubStream(
name="customer_payment_methods",
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe a hot take, but I think we should just replace the existing payment_methods stream. It's not useful as far as I could tell

@artem1205 artem1205 marked this pull request as draft August 30, 2024 16:21
Signed-off-by: Artem Inzhyyants <artem.inzhyyants@gmail.com>
Signed-off-by: Artem Inzhyyants <artem.inzhyyants@gmail.com>
Signed-off-by: Artem Inzhyyants <artem.inzhyyants@gmail.com>
…ripe-customer-payment-methods

# Conflicts:
#	airbyte-integrations/connectors/source-stripe/metadata.yaml
#	airbyte-integrations/connectors/source-stripe/pyproject.toml
#	docs/integrations/sources/stripe.md
Signed-off-by: Artem Inzhyyants <artem.inzhyyants@gmail.com>
Signed-off-by: Artem Inzhyyants <artem.inzhyyants@gmail.com>
@artem1205 artem1205 changed the title feat(source-stripe): add stream Customer Payment Methods feat(source-stripe): ref stream Payment Methods Sep 2, 2024
@artem1205 artem1205 added the breaking-change Don't merge me unless you are ready. label Sep 2, 2024
@@ -43,6 +43,12 @@ data:
scopedImpact:
- scopeType: stream
impactedScopes: ["refunds"]
6.0.0:
Copy link
Contributor

Choose a reason for hiding this comment

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

does this need to be a major version bump? this feels like something we should notify users in the docs and migration guide, but I don't think it's worth stopping their syncs

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

customer was set as object, and now it is changed to string.
This is the main reason to mark changes as breaking.
endpoint change can also affect customer incremental sync.

Copy link
Contributor

Choose a reason for hiding this comment

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

shouldn't this be part of the migration guide then?

Copy link
Contributor

Choose a reason for hiding this comment

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

🌶️ I'd still advocate for not flagging as breaking change since only one Cloud user actually has data for this stream

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ok, reverted.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

shouldn't this be part of the migration guide then?

Since i removed this version from breakingChanges in metadata, CI fails on QA checks in migration guide.
Is there any other place I can place the release notes?

Signed-off-by: Artem Inzhyyants <artem.inzhyyants@gmail.com>
Signed-off-by: Artem Inzhyyants <artem.inzhyyants@gmail.com>
Signed-off-by: Artem Inzhyyants <artem.inzhyyants@gmail.com>
Signed-off-by: Artem Inzhyyants <artem.inzhyyants@gmail.com>
Signed-off-by: Artem Inzhyyants <artem.inzhyyants@gmail.com>
Signed-off-by: Artem Inzhyyants <artem.inzhyyants@gmail.com>
Copy link
Contributor

@maxi297 maxi297 left a comment

Choose a reason for hiding this comment

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

I'm fine with the PR in the current state. If possible, I think we should add the payment method for another customer in our CATs but I'm not blocking the PR for that

Signed-off-by: Artem Inzhyyants <artem.inzhyyants@gmail.com>
Copy link
Contributor

@girarda girarda left a comment

Choose a reason for hiding this comment

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

:shipit:, assuming regression tests pass for the impacted streams (Persons, Events

@artem1205 artem1205 removed the breaking-change Don't merge me unless you are ready. label Sep 9, 2024
@girarda
Copy link
Contributor

girarda commented Sep 9, 2024

…ripe-customer-payment-methods

# Conflicts:
#	airbyte-integrations/connectors/source-stripe/metadata.yaml
#	airbyte-integrations/connectors/source-stripe/poetry.lock
#	airbyte-integrations/connectors/source-stripe/pyproject.toml
#	airbyte-integrations/connectors/source-stripe/unit_tests/test_source.py
#	docs/integrations/sources/stripe.md
Signed-off-by: Artem Inzhyyants <artem.inzhyyants@gmail.com>
Signed-off-by: Artem Inzhyyants <artem.inzhyyants@gmail.com>
@artem1205
Copy link
Collaborator Author

artem1205 commented Sep 10, 2024

Regression tests after removing python package stripe #45348 -- now relevant

UPD:
Regression tests after removing python package stripe #45348

Signed-off-by: Artem Inzhyyants <artem.inzhyyants@gmail.com>
@girarda
Copy link
Contributor

girarda commented Sep 11, 2024

/approve-and-merge reason="There is a migration guide, but no breaking change"

@octavia-approvington
Copy link
Contributor

Approve this
imagine the commander saying yes

@octavia-approvington octavia-approvington merged commit b00dac8 into master Sep 11, 2024
32 of 36 checks passed
@octavia-approvington octavia-approvington deleted the artem1205/source-stripe-customer-payment-methods branch September 11, 2024 15:42
@@ -109,7 +108,7 @@ def check_connection(self, logger: logging.Logger, config: MutableMapping[str, A
args = self._get_stream_base_args(config)
account_stream = StripeStream(name="accounts", path="accounts", use_cache=USE_CACHE, **args)
try:
next(account_stream.read_records(sync_mode=SyncMode.full_refresh))
next(account_stream.read_records(sync_mode=SyncMode.full_refresh), None)
Copy link
Collaborator

@aaronsteers aaronsteers Sep 11, 2024

Choose a reason for hiding this comment

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/connectors Connector related issues area/documentation Improvements or additions to documentation connectors/source/stripe
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants