airbyte-source-shopify 2.5.12.dev202412101009__py3-none-any.whl → 2.5.13__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {airbyte_source_shopify-2.5.12.dev202412101009.dist-info → airbyte_source_shopify-2.5.13.dist-info}/METADATA +2 -2
- {airbyte_source_shopify-2.5.12.dev202412101009.dist-info → airbyte_source_shopify-2.5.13.dist-info}/RECORD +7 -7
- source_shopify/shopify_graphql/bulk/exceptions.py +5 -0
- source_shopify/shopify_graphql/bulk/job.py +39 -4
- source_shopify/spec.json +2 -2
- {airbyte_source_shopify-2.5.12.dev202412101009.dist-info → airbyte_source_shopify-2.5.13.dist-info}/WHEEL +0 -0
- {airbyte_source_shopify-2.5.12.dev202412101009.dist-info → airbyte_source_shopify-2.5.13.dist-info}/entry_points.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: airbyte-source-shopify
|
|
3
|
-
Version: 2.5.
|
|
3
|
+
Version: 2.5.13
|
|
4
4
|
Summary: Source CDK implementation for Shopify.
|
|
5
5
|
Home-page: https://airbyte.com
|
|
6
6
|
License: ELv2
|
|
@@ -11,7 +11,7 @@ Classifier: License :: Other/Proprietary License
|
|
|
11
11
|
Classifier: Programming Language :: Python :: 3
|
|
12
12
|
Classifier: Programming Language :: Python :: 3.10
|
|
13
13
|
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
-
Requires-Dist: airbyte-cdk (>=
|
|
14
|
+
Requires-Dist: airbyte-cdk (>=6,<7)
|
|
15
15
|
Requires-Dist: graphql-query (>=1,<2)
|
|
16
16
|
Requires-Dist: sgqlc (==16.3)
|
|
17
17
|
Project-URL: Documentation, https://docs.airbyte.com/integrations/sources/shopify
|
|
@@ -52,8 +52,8 @@ source_shopify/schemas/tender_transactions.json,sha256=U8fdT-eflycEPzYSpBDiB0lp9
|
|
|
52
52
|
source_shopify/schemas/transactions.json,sha256=vbwscH3UcAtbSsC70mBka4oNaFR4S3S6IFBmzR7t37U,10226
|
|
53
53
|
source_shopify/scopes.py,sha256=K1lH6ZsdOo4YkEnHaQm8d1RlK2E4PFNsLczomchc6jk,6533
|
|
54
54
|
source_shopify/shopify_graphql/bulk/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
55
|
-
source_shopify/shopify_graphql/bulk/exceptions.py,sha256=
|
|
56
|
-
source_shopify/shopify_graphql/bulk/job.py,sha256=
|
|
55
|
+
source_shopify/shopify_graphql/bulk/exceptions.py,sha256=4dj7Za4xIfwL-zf8joT9svF_RSoGlE3GviMiIl1e1rs,2532
|
|
56
|
+
source_shopify/shopify_graphql/bulk/job.py,sha256=jR0BGVtMWBZPfAL-_rNvY4qgYE3CjPV4i-uUNWITdjQ,27634
|
|
57
57
|
source_shopify/shopify_graphql/bulk/query.py,sha256=tktkNYD3dCEPkod1OvXRckV3oEKF3X5ja32UTCow4KI,121669
|
|
58
58
|
source_shopify/shopify_graphql/bulk/record.py,sha256=X6VGngugv7a_S8UEeDo121BkdCVLj5nWlHK76A21kyo,16898
|
|
59
59
|
source_shopify/shopify_graphql/bulk/retry.py,sha256=4ICAWM74C4XHsbPNkztXA80NI48bMGD2Gsz89GmqBTU,2625
|
|
@@ -62,12 +62,12 @@ source_shopify/shopify_graphql/bulk/tools.py,sha256=g8-7NHHh1hlCWjUaLaxCxG2jR-WL
|
|
|
62
62
|
source_shopify/shopify_graphql/graphql.py,sha256=wHzppRm2zbllOp1m4zCax6SY6xo3aYnwlwIScRVk10Q,1969
|
|
63
63
|
source_shopify/shopify_graphql/schema.py,sha256=H3qj3AFjaKJ4Nsd2GlyNCQEOulDFrkQWvO00Ad3fqbY,1354903
|
|
64
64
|
source_shopify/source.py,sha256=c_Z6ynQ8yrAjgvalD0nrDUqPkdBNDxtfjKYF6q_UGzk,8568
|
|
65
|
-
source_shopify/spec.json,sha256=
|
|
65
|
+
source_shopify/spec.json,sha256=ITYWiQ-NrI5VISk5qmUQhp9ChUE2FV18d8xzVzPwvAg,6144
|
|
66
66
|
source_shopify/streams/base_streams.py,sha256=rreQGHrt_3CBdBmJ6Hq41GS10UDi1pWQMTZoeU-hTbk,40490
|
|
67
67
|
source_shopify/streams/streams.py,sha256=MTsy1fGBWV6ZGYfjE-mx7rT-eXLOngyGSYJeUhiE6po,12056
|
|
68
68
|
source_shopify/transform.py,sha256=mn0htL812_90zc_YszGQa0hHcIZQpYYdmk8IqpZm5TI,4685
|
|
69
69
|
source_shopify/utils.py,sha256=l6BhCtzcZbAd9DMpeXHHHhkPnERNNx4rfS1DuH53w0k,14460
|
|
70
|
-
airbyte_source_shopify-2.5.
|
|
71
|
-
airbyte_source_shopify-2.5.
|
|
72
|
-
airbyte_source_shopify-2.5.
|
|
73
|
-
airbyte_source_shopify-2.5.
|
|
70
|
+
airbyte_source_shopify-2.5.13.dist-info/METADATA,sha256=qaxVwN0uxaVCyr-9Gv5sA1rOVDb5Ypq9cEPCkhjOL6g,5257
|
|
71
|
+
airbyte_source_shopify-2.5.13.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
|
72
|
+
airbyte_source_shopify-2.5.13.dist-info/entry_points.txt,sha256=SyTwKSsPk9MCdPf01saWpnp8hcmZOgBssVcSIvMbBeQ,57
|
|
73
|
+
airbyte_source_shopify-2.5.13.dist-info/RECORD,,
|
|
@@ -52,6 +52,11 @@ class ShopifyBulkExceptions:
|
|
|
52
52
|
|
|
53
53
|
failure_type: FailureType = FailureType.transient_error
|
|
54
54
|
|
|
55
|
+
class BulkJobCheckpointCollisionError(BaseBulkException):
|
|
56
|
+
"""Raised when an attempt to create a job using the `checkpointed cursor` value goes into inf.loop."""
|
|
57
|
+
|
|
58
|
+
failure_type: FailureType = FailureType.transient_error
|
|
59
|
+
|
|
55
60
|
class BulkJobRedirectToOtherShopError(BaseBulkException):
|
|
56
61
|
"""Raised when the response contains another shop name"""
|
|
57
62
|
|
|
@@ -53,7 +53,7 @@ class ShopifyBulkManager:
|
|
|
53
53
|
|
|
54
54
|
# currents: _job_id, _job_state, _job_created_at, _job_self_canceled
|
|
55
55
|
_job_id: Optional[str] = field(init=False, default=None)
|
|
56
|
-
_job_state: str = field(init=False, default=None) # this string is based on ShopifyBulkJobStatus
|
|
56
|
+
_job_state: str | None = field(init=False, default=None) # this string is based on ShopifyBulkJobStatus
|
|
57
57
|
# completed and saved Bulk Job result filename
|
|
58
58
|
_job_result_filename: Optional[str] = field(init=False, default=None)
|
|
59
59
|
# date-time when the Bulk Job was created on the server
|
|
@@ -70,6 +70,8 @@ class ShopifyBulkManager:
|
|
|
70
70
|
_job_last_rec_count: int = field(init=False, default=0)
|
|
71
71
|
# the flag to adjust the next slice from the checkpointed cursor vaue
|
|
72
72
|
_job_adjust_slice_from_checkpoint: bool = field(init=False, default=False)
|
|
73
|
+
# keeps the last checkpointed cursor value for supported streams
|
|
74
|
+
_job_last_checkpoint_cursor_value: str | None = field(init=False, default=None)
|
|
73
75
|
|
|
74
76
|
# expand slice factor
|
|
75
77
|
_job_size_expand_factor: int = field(init=False, default=2)
|
|
@@ -209,6 +211,27 @@ class ShopifyBulkManager:
|
|
|
209
211
|
# reseting the checkpoint flag, if bulk job has completed normally
|
|
210
212
|
self._job_adjust_slice_from_checkpoint = False
|
|
211
213
|
|
|
214
|
+
def _set_last_checkpoint_cursor_value(self, checkpointed_cursor: str) -> None:
|
|
215
|
+
"""
|
|
216
|
+
Sets the last checkpoint cursor value.
|
|
217
|
+
|
|
218
|
+
Args:
|
|
219
|
+
checkpointed_cursor (str): The cursor value to set as the last checkpoint. Defaults to None.
|
|
220
|
+
"""
|
|
221
|
+
self._job_last_checkpoint_cursor_value = checkpointed_cursor
|
|
222
|
+
|
|
223
|
+
def _checkpoint_cursor_has_collision(self, checkpointed_cursor: str) -> bool:
|
|
224
|
+
"""
|
|
225
|
+
Checks if the provided checkpointed cursor collides with the last checkpointed cursor value.
|
|
226
|
+
|
|
227
|
+
Args:
|
|
228
|
+
checkpointed_cursor (str): The cursor value to check for collision. Defaults to None.
|
|
229
|
+
|
|
230
|
+
Returns:
|
|
231
|
+
bool: True if the provided cursor collides with the last checkpointed cursor value, False otherwise.
|
|
232
|
+
"""
|
|
233
|
+
return self._job_last_checkpoint_cursor_value == checkpointed_cursor
|
|
234
|
+
|
|
212
235
|
def _job_completed(self) -> bool:
|
|
213
236
|
return self._job_state == ShopifyBulkJobStatus.COMPLETED.value
|
|
214
237
|
|
|
@@ -329,7 +352,7 @@ class ShopifyBulkManager:
|
|
|
329
352
|
def _on_completed_job(self, response: Optional[requests.Response] = None) -> None:
|
|
330
353
|
self._job_result_filename = self._job_get_result(response)
|
|
331
354
|
|
|
332
|
-
def _on_failed_job(self, response: requests.Response) -> AirbyteTracedException:
|
|
355
|
+
def _on_failed_job(self, response: requests.Response) -> AirbyteTracedException | None:
|
|
333
356
|
if not self._supports_checkpointing:
|
|
334
357
|
raise ShopifyBulkExceptions.BulkJobFailed(
|
|
335
358
|
f"The BULK Job: `{self._job_id}` exited with {self._job_state}, details: {response.text}",
|
|
@@ -485,7 +508,7 @@ class ShopifyBulkManager:
|
|
|
485
508
|
self._job_state = ShopifyBulkJobStatus.CREATED.value
|
|
486
509
|
LOGGER.info(f"Stream: `{self.http_client.name}`, the BULK Job: `{self._job_id}` is {ShopifyBulkJobStatus.CREATED.value}")
|
|
487
510
|
|
|
488
|
-
def job_size_normalize(self, start: datetime, end: datetime) ->
|
|
511
|
+
def job_size_normalize(self, start: datetime, end: datetime) -> None:
|
|
489
512
|
# adjust slice size when it's bigger than the loop point when it should end,
|
|
490
513
|
# to preserve correct job size adjustments when this is the only job we need to run, based on STATE provided
|
|
491
514
|
requested_slice_size = (end - start).total_days()
|
|
@@ -498,8 +521,20 @@ class ShopifyBulkManager:
|
|
|
498
521
|
def _adjust_slice_end(self, slice_end: datetime, checkpointed_cursor: Optional[str] = None) -> datetime:
|
|
499
522
|
"""
|
|
500
523
|
Choose between the existing `slice_end` value or `checkpointed_cursor` value, if provided.
|
|
524
|
+
|
|
525
|
+
Optionally: raises the `transient` error if the checkpoint collision occurs.
|
|
501
526
|
"""
|
|
502
|
-
|
|
527
|
+
|
|
528
|
+
if checkpointed_cursor:
|
|
529
|
+
if self._checkpoint_cursor_has_collision(checkpointed_cursor):
|
|
530
|
+
raise ShopifyBulkExceptions.BulkJobCheckpointCollisionError(
|
|
531
|
+
f"The stream: `{self.http_client.name}` checkpoint collision is detected. Try to increase the `BULK Job checkpoint (rows collected)` to the bigger value. The stream will be synced again during the next sync attempt."
|
|
532
|
+
)
|
|
533
|
+
# set the checkpointed cursor value
|
|
534
|
+
self._set_last_checkpoint_cursor_value(checkpointed_cursor)
|
|
535
|
+
return pdm.parse(checkpointed_cursor)
|
|
536
|
+
|
|
537
|
+
return slice_end
|
|
503
538
|
|
|
504
539
|
def get_adjusted_job_end(self, slice_start: datetime, slice_end: datetime, checkpointed_cursor: Optional[str] = None) -> datetime:
|
|
505
540
|
if self._job_adjust_slice_from_checkpoint:
|
source_shopify/spec.json
CHANGED
|
@@ -115,10 +115,10 @@
|
|
|
115
115
|
"job_checkpoint_interval": {
|
|
116
116
|
"type": "integer",
|
|
117
117
|
"title": "BULK Job checkpoint (rows collected)",
|
|
118
|
-
"description": "The threshold, after which the single BULK Job should be checkpointed
|
|
118
|
+
"description": "The threshold, after which the single BULK Job should be checkpointed (min: 15k, max: 1M)",
|
|
119
119
|
"default": 100000,
|
|
120
120
|
"minimum": 15000,
|
|
121
|
-
"maximum":
|
|
121
|
+
"maximum": 1000000
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
124
|
},
|
|
File without changes
|
|
File without changes
|