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

source-stripe-native: Handle empty connected account list in resource methods #2504

Merged
merged 1 commit into from
Mar 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions source-stripe-native/config.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
credentials:
access_token_sops: ENC[AES256_GCM,data:7iG2cZ/7379LcC/C+hKbpmfPtIZpINAvI+Kl2EmrJQS4GHygNTQmvh9k3xqgZcnPihVJmfXUcAAN9xpzKLhhtx6WX335pzgI2lIveKLxa+qaAcBauFoqnZhhiAV7MsnrxDqp69SqtdA5QbU=,iv:2ESJfwINDwLkqnAsQ1n/3ZZI9YUSO3zVO9xAE3X+Wuw=,tag:p1NZ4ejRfxAb1+3RXQmYkg==,type:str]
access_token_sops: ENC[AES256_GCM,data:JLPRanyakzcBb8AMFIs0I+g5D1w7obPxQXoCi6wSV5Ot66sX2phfn1pCE34LcmTxlokAS7CSDUdAyAsw36Eltb6iZGfkHBDtJ2S3BGGz2HEen8SgnkapNkfjOJfjkvOSEFzcH/af7w1OIJQ=,iv:Qt59fJGiz9JoHltxkA7EPqWHChjB+ppXMa3izz7UqBk=,tag:mYZWNrsOQJWH7Rc+rR+u2Q==,type:str]
start_date: "2010-01-01T00:00:00+00:00"
capture_connected_accounts: false
capture_connected_accounts: true
sops:
kms: []
gcp_kms:
- resource_id: projects/estuary-theatre/locations/us-central1/keyRings/connector-keyring/cryptoKeys/connector-repository
created_at: "2025-03-04T15:38:33Z"
enc: CiQAdmEdwpifyiYXJmh1JpbtmbNtZcif3KHKcxPPsWtvwCNEp5sSSQCtUdBGHOd6Ai+9YMjMeIq9TzWF7v8RqkljcGFqHvOluAIUU4MqSa57wuUbTYTREgKxUynYRlpbOdBYpIFF+BZf4peGKj/NlsQ=
created_at: "2025-03-07T21:20:45Z"
enc: CiQAdmEdwqj7wNLmtF7bRmbZp/HTg7GH0fyXZ/0sd+HAJylZ5Q8SSQCtUdBGNtHMe91hNh4GvgqEh8NOsOj3n8uAPVtnLmgyuetL9N7hBnXzXae6bkOaZj/OehhQjTPRJrfAjJBe/FBoTPLHxMO9gbw=
azure_kv: []
hc_vault: []
age: []
lastmodified: "2025-03-04T15:38:34Z"
mac: ENC[AES256_GCM,data:hFGI3Y4t8bvBqoTWx2Qa8/UQ4AH46JZ/dwUXsRRS1D3Bh7uS7javuXLf3bSRIynXV6Y+u79ZJsbH26L8Ifr5fwUBWXhn7eI94s0N0rn1F1TUklQKpHQAN3p7x9b8hn8XvFjEDBBQPXQQQFT0Hltn+g2kKhE1e+nFUvI98DV/9Bk=,iv:KA6kD6QP71Giz/uxZ1ceHuPOwImBWY3KHyGDqGrmV1U=,tag:licITgXgJHodNH+MVLuY/Q==,type:str]
lastmodified: "2025-03-07T21:20:45Z"
mac: ENC[AES256_GCM,data:I3mhDLPF07sAGViAGYXSZMx//Pp3pJOoFARqrEagfoR+96evSb845q818SxqEJeUVkPF0Weue6f9FwSyuAUHpu9+LPYAZrVixHr/HeFEFLfvCe/yFf0fTXO7GhsKdGiucqzrd6nRc6/byVyka75H86MzCsdrOW5zVyfwXPr0jUM=,iv:HguMQ+BM+H2AIpdUMlWW9oDWRL4zzB+JZYTLC7xQblU=,tag:B1AV7zVrP5hQ7kMrUe6m7w==,type:str]
pgp: []
encrypted_suffix: _sops
version: 3.9.4
222 changes: 172 additions & 50 deletions source-stripe-native/source_stripe_native/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,19 +235,47 @@ def open(
task: Task,
all_bindings,
):
fetch_changes_fns = {
account_id: functools.partial(
fetch_incremental, cls, platform_account_id, account_id, http
if not connected_account_ids or len(connected_account_ids) == 0:
fetch_changes_fns = functools.partial(
fetch_incremental,
cls,
platform_account_id,
None,
http,
)
for account_id in all_account_ids
}
else:
fetch_changes_fns = {
account_id: functools.partial(
fetch_incremental,
cls,
platform_account_id,
account_id,
http,
)
for account_id in all_account_ids
}

fetch_page_fns = {
account_id: functools.partial(
fetch_backfill, cls, start_date, platform_account_id, account_id, http
if not connected_account_ids or len(connected_account_ids) == 0:
fetch_page_fns = functools.partial(
fetch_backfill,
cls,
start_date,
platform_account_id,
None,
http,
)
for account_id in all_account_ids
}
else:
fetch_page_fns = {
account_id: functools.partial(
fetch_backfill,
cls,
start_date,
platform_account_id,
account_id,
http,
)
for account_id in all_account_ids
}

open_binding(
binding,
Expand Down Expand Up @@ -293,30 +321,51 @@ def open(
task: Task,
all_bindings,
):
fetch_changes_fns = {
account_id: functools.partial(
if not connected_account_ids or len(connected_account_ids) == 0:
fetch_changes_fns = functools.partial(
fetch_incremental_substreams,
cls,
child_cls,
platform_account_id,
account_id,
None,
http,
)
for account_id in all_account_ids
}
else:
fetch_changes_fns = {
account_id: functools.partial(
fetch_incremental_substreams,
cls,
child_cls,
platform_account_id,
account_id,
http,
)
for account_id in all_account_ids
}

fetch_page_fns = {
account_id: functools.partial(
if not connected_account_ids or len(connected_account_ids) == 0:
fetch_page_fns = functools.partial(
fetch_backfill_substreams,
cls,
child_cls,
start_date,
platform_account_id,
account_id,
None,
http,
)
for account_id in all_account_ids
}
else:
fetch_page_fns = {
account_id: functools.partial(
fetch_backfill_substreams,
cls,
child_cls,
start_date,
platform_account_id,
account_id,
http,
)
for account_id in all_account_ids
}

open_binding(
binding,
Expand Down Expand Up @@ -365,25 +414,49 @@ def open(
task: Task,
all_bindings,
):
fetch_changes_fns = {
account_id: functools.partial(
fetch_incremental, child_cls, platform_account_id, account_id, http
if not connected_account_ids or len(connected_account_ids) == 0:
fetch_changes_fns = functools.partial(
fetch_incremental,
child_cls,
platform_account_id,
None,
http,
)
for account_id in all_account_ids
}
else:
fetch_changes_fns = {
account_id: functools.partial(
fetch_incremental,
child_cls,
platform_account_id,
account_id,
http,
)
for account_id in all_account_ids
}

fetch_page_fns = {
account_id: functools.partial(
if not connected_account_ids or len(connected_account_ids) == 0:
fetch_page_fns = functools.partial(
fetch_backfill_substreams,
cls,
child_cls,
start_date,
platform_account_id,
account_id,
None,
http,
)
for account_id in all_account_ids
}
else:
fetch_page_fns = {
account_id: functools.partial(
fetch_backfill_substreams,
cls,
child_cls,
start_date,
platform_account_id,
account_id,
http,
)
for account_id in all_account_ids
}

open_binding(
binding,
Expand Down Expand Up @@ -431,30 +504,51 @@ def open(
task: Task,
all_bindings,
):
fetch_changes_fns = {
account_id: functools.partial(
if not connected_account_ids or len(connected_account_ids) == 0:
fetch_changes_fns = functools.partial(
fetch_incremental_usage_records,
cls,
child_cls,
platform_account_id,
account_id,
None,
http,
)
for account_id in all_account_ids
}
else:
fetch_changes_fns = {
account_id: functools.partial(
fetch_incremental_usage_records,
cls,
child_cls,
platform_account_id,
account_id,
http,
)
for account_id in all_account_ids
}

fetch_page_fns = {
account_id: functools.partial(
if not connected_account_ids or len(connected_account_ids) == 0:
fetch_page_fns = functools.partial(
fetch_backfill_usage_records,
cls,
child_cls,
start_date,
platform_account_id,
account_id,
None,
http,
)
for account_id in all_account_ids
}
else:
fetch_page_fns = {
account_id: functools.partial(
fetch_backfill_usage_records,
cls,
child_cls,
start_date,
platform_account_id,
account_id,
http,
)
for account_id in all_account_ids
}

open_binding(
binding,
Expand Down Expand Up @@ -502,19 +596,47 @@ def open(
task: Task,
all_bindings,
):
fetch_changes_fns = {
account_id: functools.partial(
fetch_incremental_no_events, cls, platform_account_id, account_id, http
if not connected_account_ids or len(connected_account_ids) == 0:
fetch_changes_fns = functools.partial(
fetch_incremental_no_events,
cls,
platform_account_id,
None,
http,
)
for account_id in all_account_ids
}
else:
fetch_changes_fns = {
account_id: functools.partial(
fetch_incremental_no_events,
cls,
platform_account_id,
account_id,
http,
)
for account_id in all_account_ids
}

fetch_page_fns = {
account_id: functools.partial(
fetch_backfill, cls, start_date, platform_account_id, account_id, http
if not connected_account_ids or len(connected_account_ids) == 0:
fetch_page_fns = functools.partial(
fetch_backfill,
cls,
start_date,
platform_account_id,
None,
http,
)
for account_id in all_account_ids
}
else:
fetch_page_fns = {
account_id: functools.partial(
fetch_backfill,
cls,
start_date,
platform_account_id,
account_id,
http,
)
for account_id in all_account_ids
}

open_binding(
binding,
Expand Down
Loading
Loading