airbyte-cdk 6.33.0__py3-none-any.whl → 6.33.1__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.
@@ -299,23 +299,33 @@ class SubstreamPartitionRouter(PartitionRouter):
299
299
 
300
300
  def _migrate_child_state_to_parent_state(self, stream_state: StreamState) -> StreamState:
301
301
  """
302
- Migrate the child stream state to the parent stream's state format.
302
+ Migrate the child or global stream state into the parent stream's state format.
303
303
 
304
- This method converts the global or child state into a format compatible with parent
305
- streams. The migration occurs only for parent streams with incremental dependencies.
306
- The method filters out per-partition states and retains only the global state in the
307
- format `{cursor_field: cursor_value}`.
304
+ This method converts the child stream state—or, if present, the global stateinto a format that is
305
+ compatible with parent streams that use incremental synchronization. The migration occurs only for
306
+ parent streams with incremental dependencies. It filters out per-partition states and retains only the
307
+ global state in the form {cursor_field: cursor_value}.
308
+
309
+ The method supports multiple input formats:
310
+ - A simple global state, e.g.:
311
+ {"updated_at": "2023-05-27T00:00:00Z"}
312
+ - A state object that contains a "state" key (which is assumed to hold the global state), e.g.:
313
+ {"state": {"updated_at": "2023-05-27T00:00:00Z"}, ...}
314
+ In this case, the migration uses the first value from the "state" dictionary.
315
+ - Any per-partition state formats or other non-simple structures are ignored during migration.
308
316
 
309
317
  Args:
310
318
  stream_state (StreamState): The state to migrate. Expected formats include:
311
319
  - {"updated_at": "2023-05-27T00:00:00Z"}
312
- - {"states": [...] } (ignored during migration)
320
+ - {"state": {"updated_at": "2023-05-27T00:00:00Z"}, ...}
321
+ (In this format, only the first global state value is used, and per-partition states are ignored.)
313
322
 
314
323
  Returns:
315
324
  StreamState: A migrated state for parent streams in the format:
316
325
  {
317
326
  "parent_stream_name": {"parent_stream_cursor": "2023-05-27T00:00:00Z"}
318
327
  }
328
+ where each parent stream with an incremental dependency is assigned its corresponding cursor value.
319
329
 
320
330
  Example:
321
331
  Input: {"updated_at": "2023-05-27T00:00:00Z"}
@@ -326,11 +336,15 @@ class SubstreamPartitionRouter(PartitionRouter):
326
336
  substream_state_values = list(stream_state.values())
327
337
  substream_state = substream_state_values[0] if substream_state_values else {}
328
338
 
329
- # Ignore per-partition states or invalid formats
339
+ # Ignore per-partition states or invalid formats.
330
340
  if isinstance(substream_state, (list, dict)) or len(substream_state_values) != 1:
331
- return {}
341
+ # If a global state is present under the key "state", use its first value.
342
+ if "state" in stream_state and isinstance(stream_state["state"], dict):
343
+ substream_state = list(stream_state["state"].values())[0]
344
+ else:
345
+ return {}
332
346
 
333
- # Copy child state to parent streams with incremental dependencies
347
+ # Build the parent state for all parent streams with incremental dependencies.
334
348
  parent_state = {}
335
349
  if substream_state:
336
350
  for parent_config in self.parent_stream_configs:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: airbyte-cdk
3
- Version: 6.33.0
3
+ Version: 6.33.1
4
4
  Summary: A framework for writing Airbyte Connectors.
5
5
  Home-page: https://airbyte.com
6
6
  License: MIT
@@ -122,7 +122,7 @@ airbyte_cdk/sources/declarative/partition_routers/cartesian_product_stream_slice
122
122
  airbyte_cdk/sources/declarative/partition_routers/list_partition_router.py,sha256=tmGGpMoOBmaMfhVZq53AEWxoHm2lmNVi6hA2_IVEnAA,4882
123
123
  airbyte_cdk/sources/declarative/partition_routers/partition_router.py,sha256=YyEIzdmLd1FjbVP3QbQ2VFCLW_P-OGbVh6VpZShp54k,2218
124
124
  airbyte_cdk/sources/declarative/partition_routers/single_partition_router.py,sha256=SKzKjSyfccq4dxGIh-J6ejrgkCHzaiTIazmbmeQiRD4,1942
125
- airbyte_cdk/sources/declarative/partition_routers/substream_partition_router.py,sha256=sqNF8hPdDn7EUCB2-Y-8xtZFPO1ncVNrCsdPljdczJ8,16575
125
+ airbyte_cdk/sources/declarative/partition_routers/substream_partition_router.py,sha256=LlWj-Ofs-xfjlqmDzH8OYpyblP2Pb8bPDdR9g1UZyt0,17693
126
126
  airbyte_cdk/sources/declarative/requesters/README.md,sha256=eL1I4iLkxaw7hJi9S9d18_XcRl-R8lUSjqBVJJzvXmg,2656
127
127
  airbyte_cdk/sources/declarative/requesters/__init__.py,sha256=d7a3OoHbqaJDyyPli3nqqJ2yAW_SLX6XDaBAKOwvpxw,364
128
128
  airbyte_cdk/sources/declarative/requesters/error_handlers/__init__.py,sha256=SkEDcJxlT1683rNx93K9whoS0OyUukkuOfToGtgpF58,776
@@ -351,9 +351,9 @@ airbyte_cdk/utils/slice_hasher.py,sha256=EDxgROHDbfG-QKQb59m7h_7crN1tRiawdf5uU7G
351
351
  airbyte_cdk/utils/spec_schema_transformations.py,sha256=-5HTuNsnDBAhj-oLeQXwpTGA0HdcjFOf2zTEMUTTg_Y,816
352
352
  airbyte_cdk/utils/stream_status_utils.py,sha256=ZmBoiy5HVbUEHAMrUONxZvxnvfV9CesmQJLDTAIWnWw,1171
353
353
  airbyte_cdk/utils/traced_exception.py,sha256=C8uIBuCL_E4WnBAOPSxBicD06JAldoN9fGsQDp463OY,6292
354
- airbyte_cdk-6.33.0.dist-info/LICENSE.txt,sha256=Wfe61S4BaGPj404v8lrAbvhjYR68SHlkzeYrg3_bbuM,1051
355
- airbyte_cdk-6.33.0.dist-info/LICENSE_SHORT,sha256=aqF6D1NcESmpn-cqsxBtszTEnHKnlsp8L4x9wAh3Nxg,55
356
- airbyte_cdk-6.33.0.dist-info/METADATA,sha256=zem-s1VWtFeGuvTO6ohvvi687MVXqmQ_QrcRWM6KnAM,6010
357
- airbyte_cdk-6.33.0.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
358
- airbyte_cdk-6.33.0.dist-info/entry_points.txt,sha256=fj-e3PAQvsxsQzyyq8UkG1k8spunWnD4BAH2AwlR6NM,95
359
- airbyte_cdk-6.33.0.dist-info/RECORD,,
354
+ airbyte_cdk-6.33.1.dist-info/LICENSE.txt,sha256=Wfe61S4BaGPj404v8lrAbvhjYR68SHlkzeYrg3_bbuM,1051
355
+ airbyte_cdk-6.33.1.dist-info/LICENSE_SHORT,sha256=aqF6D1NcESmpn-cqsxBtszTEnHKnlsp8L4x9wAh3Nxg,55
356
+ airbyte_cdk-6.33.1.dist-info/METADATA,sha256=OF2QwAsdOE8KWGY1XzCBoIA28Yu3GpJ41yNW-AlkNBE,6010
357
+ airbyte_cdk-6.33.1.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
358
+ airbyte_cdk-6.33.1.dist-info/entry_points.txt,sha256=fj-e3PAQvsxsQzyyq8UkG1k8spunWnD4BAH2AwlR6NM,95
359
+ airbyte_cdk-6.33.1.dist-info/RECORD,,