airbyte-cdk 6.48.14__py3-none-any.whl → 6.48.14.post2.dev15055659065__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.
@@ -78,16 +78,20 @@ class LegacyToPerPartitionStateMigration(StateMigration):
78
78
  "<cursor_field>" : "<cursor_value>"
79
79
  }
80
80
  """
81
- if stream_state:
82
- for key, value in stream_state.items():
83
- if isinstance(value, dict):
84
- keys = list(value.keys())
85
- if len(keys) != 1:
86
- # The input partitioned state should only have one key
87
- return False
88
- if keys[0] != self._cursor_field:
89
- # Unexpected key. Found {keys[0]}. Expected {self._cursor.cursor_field}
90
- return False
81
+ if not stream_state:
82
+ return False
83
+ for key, value in stream_state.items():
84
+ # it is expected the internal value to be a dictionary according to docstring
85
+ if not isinstance(value, dict):
86
+ return False
87
+ keys = list(value.keys())
88
+ if len(keys) != 1:
89
+ # The input partitioned state should only have one key
90
+ return False
91
+ if keys[0] != self._cursor_field:
92
+ # Unexpected key. Found {keys[0]}. Expected {self._cursor.cursor_field}
93
+ return False
94
+
91
95
  return True
92
96
 
93
97
  def migrate(self, stream_state: Mapping[str, Any]) -> Mapping[str, Any]:
@@ -928,9 +928,9 @@ class ModelToComponentFactory:
928
928
  declarative_stream: DeclarativeStreamModel,
929
929
  ) -> LegacyToPerPartitionStateMigration:
930
930
  retriever = declarative_stream.retriever
931
- if not isinstance(retriever, SimpleRetrieverModel):
931
+ if not isinstance(retriever, (SimpleRetrieverModel, AsyncRetrieverModel)):
932
932
  raise ValueError(
933
- f"LegacyToPerPartitionStateMigrations can only be applied on a DeclarativeStream with a SimpleRetriever. Got {type(retriever)}"
933
+ f"LegacyToPerPartitionStateMigrations can only be applied on a DeclarativeStream with a SimpleRetriever or AsyncRetriever. Got {type(retriever)}"
934
934
  )
935
935
  partition_router = retriever.partition_router
936
936
  if not isinstance(
@@ -1999,6 +1999,17 @@ class ModelToComponentFactory:
1999
1999
  stream_state = self._connector_state_manager.get_stream_state(
2000
2000
  stream_name, stream_namespace
2001
2001
  )
2002
+ state_transformations = (
2003
+ [
2004
+ self._create_component_from_model(
2005
+ state_migration, config, declarative_stream=model
2006
+ )
2007
+ for state_migration in model.state_migrations
2008
+ ]
2009
+ if model.state_migrations
2010
+ else []
2011
+ )
2012
+
2002
2013
  return self.create_concurrent_cursor_from_perpartition_cursor( # type: ignore # This is a known issue that we are creating and returning a ConcurrentCursor which does not technically implement the (low-code) StreamSlicer. However, (low-code) StreamSlicer and ConcurrentCursor both implement StreamSlicer.stream_slices() which is the primary method needed for checkpointing
2003
2014
  state_manager=self._connector_state_manager,
2004
2015
  model_type=DatetimeBasedCursorModel,
@@ -2007,6 +2018,7 @@ class ModelToComponentFactory:
2007
2018
  stream_namespace=stream_namespace,
2008
2019
  config=config or {},
2009
2020
  stream_state=stream_state,
2021
+ stream_state_migrations=state_transformations,
2010
2022
  partition_router=stream_slicer,
2011
2023
  )
2012
2024
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: airbyte-cdk
3
- Version: 6.48.14
3
+ Version: 6.48.14.post2.dev15055659065
4
4
  Summary: A framework for writing Airbyte Connectors.
5
5
  Home-page: https://airbyte.com
6
6
  License: MIT
@@ -129,7 +129,7 @@ airbyte_cdk/sources/declarative/interpolation/jinja.py,sha256=UQeuS4Vpyp4hlOn-R3
129
129
  airbyte_cdk/sources/declarative/interpolation/macros.py,sha256=UYSJ5gW7TkHALYnNvUnRP3RlyGwGuRMObF3BHuNzjJM,5320
130
130
  airbyte_cdk/sources/declarative/manifest_declarative_source.py,sha256=cZNUOeIogrCmCS7RXeJqQIlnsANigz1cngpLko02M2g,23191
131
131
  airbyte_cdk/sources/declarative/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
132
- airbyte_cdk/sources/declarative/migrations/legacy_to_per_partition_state_migration.py,sha256=iemy3fKLczcU0-Aor7tx5jcT6DRedKMqyK7kCOp01hg,3924
132
+ airbyte_cdk/sources/declarative/migrations/legacy_to_per_partition_state_migration.py,sha256=V2lpYE9LJKvz6BUViHk4vaRGndxNABmPbDCtyYdkqaE,4013
133
133
  airbyte_cdk/sources/declarative/migrations/state_migration.py,sha256=KWPjealMLKSMtajXgkdGgKg7EmTLR-CqqD7UIh0-eDU,794
134
134
  airbyte_cdk/sources/declarative/models/__init__.py,sha256=nUFxNCiKeYRVXuZEKA7GD-lTHxsiKcQ8FitZjKhPIvE,100
135
135
  airbyte_cdk/sources/declarative/models/base_model_with_deprecations.py,sha256=Imnj3yef0aqRdLfaUxkIYISUb8YkiPrRH_wBd-x8HjM,5999
@@ -140,7 +140,7 @@ airbyte_cdk/sources/declarative/parsers/custom_exceptions.py,sha256=wnRUP0Xeru9R
140
140
  airbyte_cdk/sources/declarative/parsers/manifest_component_transformer.py,sha256=2UdpCz3yi7ISZTyqkQXSSy3dMxeyOWqV7OlAS5b9GVg,11568
141
141
  airbyte_cdk/sources/declarative/parsers/manifest_normalizer.py,sha256=laBy7ebjA-PiNwc-50U4FHvMqS_mmHvnabxgFs4CjGw,17069
142
142
  airbyte_cdk/sources/declarative/parsers/manifest_reference_resolver.py,sha256=pJmg78vqE5VfUrF_KJnWjucQ4k9IWFULeAxHCowrHXE,6806
143
- airbyte_cdk/sources/declarative/parsers/model_to_component_factory.py,sha256=kNUADnpJMUauIV7HxzkBHmtneqca9Kh6eenIORP9D-U,167923
143
+ airbyte_cdk/sources/declarative/parsers/model_to_component_factory.py,sha256=uPefJHWYdLxupSVqI4_VnU30JlbA44EQ7GwY0RdfaVw,168443
144
144
  airbyte_cdk/sources/declarative/partition_routers/__init__.py,sha256=TBC9AkGaUqHm2IKHMPN6punBIcY5tWGULowcLoAVkfw,1109
145
145
  airbyte_cdk/sources/declarative/partition_routers/async_job_partition_router.py,sha256=VelO7zKqKtzMJ35jyFeg0ypJLQC0plqqIBNXoBW1G2E,3001
146
146
  airbyte_cdk/sources/declarative/partition_routers/cartesian_product_stream_slicer.py,sha256=c5cuVFM6NFkuQqG8Z5IwkBuwDrvXZN1CunUOM_L0ezg,6892
@@ -419,9 +419,9 @@ airbyte_cdk/utils/slice_hasher.py,sha256=EDxgROHDbfG-QKQb59m7h_7crN1tRiawdf5uU7G
419
419
  airbyte_cdk/utils/spec_schema_transformations.py,sha256=-5HTuNsnDBAhj-oLeQXwpTGA0HdcjFOf2zTEMUTTg_Y,816
420
420
  airbyte_cdk/utils/stream_status_utils.py,sha256=ZmBoiy5HVbUEHAMrUONxZvxnvfV9CesmQJLDTAIWnWw,1171
421
421
  airbyte_cdk/utils/traced_exception.py,sha256=C8uIBuCL_E4WnBAOPSxBicD06JAldoN9fGsQDp463OY,6292
422
- airbyte_cdk-6.48.14.dist-info/LICENSE.txt,sha256=Wfe61S4BaGPj404v8lrAbvhjYR68SHlkzeYrg3_bbuM,1051
423
- airbyte_cdk-6.48.14.dist-info/LICENSE_SHORT,sha256=aqF6D1NcESmpn-cqsxBtszTEnHKnlsp8L4x9wAh3Nxg,55
424
- airbyte_cdk-6.48.14.dist-info/METADATA,sha256=x8gIZRmzk_8_46jPM3-pIfpnPgk3_4jRWY_ED5MH7s8,6344
425
- airbyte_cdk-6.48.14.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
426
- airbyte_cdk-6.48.14.dist-info/entry_points.txt,sha256=AKWbEkHfpzzk9nF9tqBUaw1MbvTM4mGtEzmZQm0ZWvM,139
427
- airbyte_cdk-6.48.14.dist-info/RECORD,,
422
+ airbyte_cdk-6.48.14.post2.dev15055659065.dist-info/LICENSE.txt,sha256=Wfe61S4BaGPj404v8lrAbvhjYR68SHlkzeYrg3_bbuM,1051
423
+ airbyte_cdk-6.48.14.post2.dev15055659065.dist-info/LICENSE_SHORT,sha256=aqF6D1NcESmpn-cqsxBtszTEnHKnlsp8L4x9wAh3Nxg,55
424
+ airbyte_cdk-6.48.14.post2.dev15055659065.dist-info/METADATA,sha256=AjuFoAUTmKt5Q4DrweJspBD5SE8pT4j-hXVanX4lwbw,6365
425
+ airbyte_cdk-6.48.14.post2.dev15055659065.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
426
+ airbyte_cdk-6.48.14.post2.dev15055659065.dist-info/entry_points.txt,sha256=AKWbEkHfpzzk9nF9tqBUaw1MbvTM4mGtEzmZQm0ZWvM,139
427
+ airbyte_cdk-6.48.14.post2.dev15055659065.dist-info/RECORD,,