airbyte-cdk 7.1.0.post4.dev17948197380__py3-none-any.whl → 7.1.1.post4.dev18076498401__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_cdk/sources/declarative/parsers/model_to_component_factory.py +24 -40
- {airbyte_cdk-7.1.0.post4.dev17948197380.dist-info → airbyte_cdk-7.1.1.post4.dev18076498401.dist-info}/METADATA +1 -1
- {airbyte_cdk-7.1.0.post4.dev17948197380.dist-info → airbyte_cdk-7.1.1.post4.dev18076498401.dist-info}/RECORD +7 -7
- {airbyte_cdk-7.1.0.post4.dev17948197380.dist-info → airbyte_cdk-7.1.1.post4.dev18076498401.dist-info}/LICENSE.txt +0 -0
- {airbyte_cdk-7.1.0.post4.dev17948197380.dist-info → airbyte_cdk-7.1.1.post4.dev18076498401.dist-info}/LICENSE_SHORT +0 -0
- {airbyte_cdk-7.1.0.post4.dev17948197380.dist-info → airbyte_cdk-7.1.1.post4.dev18076498401.dist-info}/WHEEL +0 -0
- {airbyte_cdk-7.1.0.post4.dev17948197380.dist-info → airbyte_cdk-7.1.1.post4.dev18076498401.dist-info}/entry_points.txt +0 -0
@@ -1264,22 +1264,12 @@ class ModelToComponentFactory:
|
|
1264
1264
|
component_definition: ComponentDefinition,
|
1265
1265
|
stream_name: str,
|
1266
1266
|
stream_namespace: Optional[str],
|
1267
|
+
stream_state: MutableMapping[str, Any],
|
1267
1268
|
config: Config,
|
1268
1269
|
message_repository: Optional[MessageRepository] = None,
|
1269
1270
|
runtime_lookback_window: Optional[datetime.timedelta] = None,
|
1270
|
-
stream_state_migrations: Optional[List[Any]] = None,
|
1271
1271
|
**kwargs: Any,
|
1272
1272
|
) -> ConcurrentCursor:
|
1273
|
-
# Per-partition incremental streams can dynamically create child cursors which will pass their current
|
1274
|
-
# state via the stream_state keyword argument. Incremental syncs without parent streams use the
|
1275
|
-
# incoming state and connector_state_manager that is initialized when the component factory is created
|
1276
|
-
stream_state = (
|
1277
|
-
self._connector_state_manager.get_stream_state(stream_name, stream_namespace)
|
1278
|
-
if "stream_state" not in kwargs
|
1279
|
-
else kwargs["stream_state"]
|
1280
|
-
)
|
1281
|
-
stream_state = self.apply_stream_state_migrations(stream_state_migrations, stream_state)
|
1282
|
-
|
1283
1273
|
component_type = component_definition.get("type")
|
1284
1274
|
if component_definition.get("type") != model_type.__name__:
|
1285
1275
|
raise ValueError(
|
@@ -1498,21 +1488,11 @@ class ModelToComponentFactory:
|
|
1498
1488
|
component_definition: ComponentDefinition,
|
1499
1489
|
stream_name: str,
|
1500
1490
|
stream_namespace: Optional[str],
|
1491
|
+
stream_state: MutableMapping[str, Any],
|
1501
1492
|
config: Config,
|
1502
1493
|
message_repository: Optional[MessageRepository] = None,
|
1503
|
-
stream_state_migrations: Optional[List[Any]] = None,
|
1504
1494
|
**kwargs: Any,
|
1505
1495
|
) -> ConcurrentCursor:
|
1506
|
-
# Per-partition incremental streams can dynamically create child cursors which will pass their current
|
1507
|
-
# state via the stream_state keyword argument. Incremental syncs without parent streams use the
|
1508
|
-
# incoming state and connector_state_manager that is initialized when the component factory is created
|
1509
|
-
stream_state = (
|
1510
|
-
self._connector_state_manager.get_stream_state(stream_name, stream_namespace)
|
1511
|
-
if "stream_state" not in kwargs
|
1512
|
-
else kwargs["stream_state"]
|
1513
|
-
)
|
1514
|
-
stream_state = self.apply_stream_state_migrations(stream_state_migrations, stream_state)
|
1515
|
-
|
1516
1496
|
component_type = component_definition.get("type")
|
1517
1497
|
if component_definition.get("type") != model_type.__name__:
|
1518
1498
|
raise ValueError(
|
@@ -1587,7 +1567,6 @@ class ModelToComponentFactory:
|
|
1587
1567
|
config: Config,
|
1588
1568
|
stream_state: MutableMapping[str, Any],
|
1589
1569
|
partition_router: PartitionRouter,
|
1590
|
-
stream_state_migrations: Optional[List[Any]] = None,
|
1591
1570
|
attempt_to_create_cursor_if_not_provided: bool = False,
|
1592
1571
|
**kwargs: Any,
|
1593
1572
|
) -> ConcurrentPerPartitionCursor:
|
@@ -1647,11 +1626,9 @@ class ModelToComponentFactory:
|
|
1647
1626
|
stream_namespace=stream_namespace,
|
1648
1627
|
config=config,
|
1649
1628
|
message_repository=NoopMessageRepository(),
|
1650
|
-
# stream_state_migrations=stream_state_migrations, # FIXME is it expected to run migration on per partition state too?
|
1651
1629
|
)
|
1652
1630
|
)
|
1653
1631
|
|
1654
|
-
stream_state = self.apply_stream_state_migrations(stream_state_migrations, stream_state)
|
1655
1632
|
# Per-partition state doesn't make sense for GroupingPartitionRouter, so force the global state
|
1656
1633
|
use_global_cursor = isinstance(
|
1657
1634
|
partition_router, GroupingPartitionRouter
|
@@ -1974,6 +1951,7 @@ class ModelToComponentFactory:
|
|
1974
1951
|
self, model: DeclarativeStreamModel, config: Config, is_parent: bool = False, **kwargs: Any
|
1975
1952
|
) -> AbstractStream:
|
1976
1953
|
primary_key = model.primary_key.__root__ if model.primary_key else None
|
1954
|
+
self._migrate_state(model, config)
|
1977
1955
|
|
1978
1956
|
partition_router = self._build_stream_slicer_from_partition_router(
|
1979
1957
|
model.retriever,
|
@@ -2135,6 +2113,23 @@ class ModelToComponentFactory:
|
|
2135
2113
|
supports_file_transfer=hasattr(model, "file_uploader") and bool(model.file_uploader),
|
2136
2114
|
)
|
2137
2115
|
|
2116
|
+
def _migrate_state(self, model: DeclarativeStreamModel, config: Config) -> None:
|
2117
|
+
stream_name = model.name or ""
|
2118
|
+
stream_state = self._connector_state_manager.get_stream_state(
|
2119
|
+
stream_name=stream_name, namespace=None
|
2120
|
+
)
|
2121
|
+
if model.state_migrations:
|
2122
|
+
state_transformations = [
|
2123
|
+
self._create_component_from_model(state_migration, config, declarative_stream=model)
|
2124
|
+
for state_migration in model.state_migrations
|
2125
|
+
]
|
2126
|
+
else:
|
2127
|
+
state_transformations = []
|
2128
|
+
stream_state = self.apply_stream_state_migrations(state_transformations, stream_state)
|
2129
|
+
self._connector_state_manager.update_state_for_stream(
|
2130
|
+
stream_name=stream_name, namespace=None, value=stream_state
|
2131
|
+
)
|
2132
|
+
|
2138
2133
|
def _is_stop_condition_on_cursor(self, model: DeclarativeStreamModel) -> bool:
|
2139
2134
|
return bool(
|
2140
2135
|
model.incremental_sync
|
@@ -2206,17 +2201,7 @@ class ModelToComponentFactory:
|
|
2206
2201
|
config: Config,
|
2207
2202
|
) -> Cursor:
|
2208
2203
|
stream_name = model.name or ""
|
2209
|
-
stream_state = self._connector_state_manager.get_stream_state(
|
2210
|
-
stream_name=stream_name, namespace=None
|
2211
|
-
)
|
2212
|
-
|
2213
|
-
if model.state_migrations:
|
2214
|
-
state_transformations = [
|
2215
|
-
self._create_component_from_model(state_migration, config, declarative_stream=model)
|
2216
|
-
for state_migration in model.state_migrations
|
2217
|
-
]
|
2218
|
-
else:
|
2219
|
-
state_transformations = []
|
2204
|
+
stream_state = self._connector_state_manager.get_stream_state(stream_name, None)
|
2220
2205
|
|
2221
2206
|
if (
|
2222
2207
|
model.incremental_sync
|
@@ -2228,10 +2213,9 @@ class ModelToComponentFactory:
|
|
2228
2213
|
model_type=DatetimeBasedCursorModel,
|
2229
2214
|
component_definition=model.incremental_sync.__dict__,
|
2230
2215
|
stream_name=stream_name,
|
2216
|
+
stream_state=stream_state,
|
2231
2217
|
stream_namespace=None,
|
2232
2218
|
config=config or {},
|
2233
|
-
stream_state=stream_state,
|
2234
|
-
stream_state_migrations=state_transformations,
|
2235
2219
|
partition_router=stream_slicer,
|
2236
2220
|
attempt_to_create_cursor_if_not_provided=True, # FIXME can we remove that now?
|
2237
2221
|
)
|
@@ -2242,8 +2226,8 @@ class ModelToComponentFactory:
|
|
2242
2226
|
component_definition=model.incremental_sync.__dict__,
|
2243
2227
|
stream_name=stream_name,
|
2244
2228
|
stream_namespace=None,
|
2229
|
+
stream_state=stream_state,
|
2245
2230
|
config=config or {},
|
2246
|
-
stream_state_migrations=state_transformations,
|
2247
2231
|
)
|
2248
2232
|
elif type(model.incremental_sync) == DatetimeBasedCursorModel:
|
2249
2233
|
return self.create_concurrent_cursor_from_datetime_based_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
|
@@ -2251,8 +2235,8 @@ class ModelToComponentFactory:
|
|
2251
2235
|
component_definition=model.incremental_sync.__dict__,
|
2252
2236
|
stream_name=stream_name,
|
2253
2237
|
stream_namespace=None,
|
2238
|
+
stream_state=stream_state,
|
2254
2239
|
config=config or {},
|
2255
|
-
stream_state_migrations=state_transformations,
|
2256
2240
|
attempt_to_create_cursor_if_not_provided=True,
|
2257
2241
|
)
|
2258
2242
|
else:
|
@@ -172,7 +172,7 @@ airbyte_cdk/sources/declarative/parsers/custom_exceptions.py,sha256=wnRUP0Xeru9R
|
|
172
172
|
airbyte_cdk/sources/declarative/parsers/manifest_component_transformer.py,sha256=la9Ulpc0lQewiBLKJ0FpsWxyU5XISv-ulmFRHJLJ1Pc,11292
|
173
173
|
airbyte_cdk/sources/declarative/parsers/manifest_normalizer.py,sha256=EtKjS9c94yNp3AwQC8KUCQaAYW5T3zvFYxoWYjc_buI,19729
|
174
174
|
airbyte_cdk/sources/declarative/parsers/manifest_reference_resolver.py,sha256=pJmg78vqE5VfUrF_KJnWjucQ4k9IWFULeAxHCowrHXE,6806
|
175
|
-
airbyte_cdk/sources/declarative/parsers/model_to_component_factory.py,sha256=
|
175
|
+
airbyte_cdk/sources/declarative/parsers/model_to_component_factory.py,sha256=HetH_V7m96aoeuat55UVKcWQhHLNWYKicr1zqH49mIY,183379
|
176
176
|
airbyte_cdk/sources/declarative/partition_routers/__init__.py,sha256=TBC9AkGaUqHm2IKHMPN6punBIcY5tWGULowcLoAVkfw,1109
|
177
177
|
airbyte_cdk/sources/declarative/partition_routers/async_job_partition_router.py,sha256=VelO7zKqKtzMJ35jyFeg0ypJLQC0plqqIBNXoBW1G2E,3001
|
178
178
|
airbyte_cdk/sources/declarative/partition_routers/cartesian_product_stream_slicer.py,sha256=ocm4hZ4k-tEGs5HLrtI8ecWSK0hGqNH0Rvz2byx_HZk,6927
|
@@ -457,9 +457,9 @@ airbyte_cdk/utils/slice_hasher.py,sha256=EDxgROHDbfG-QKQb59m7h_7crN1tRiawdf5uU7G
|
|
457
457
|
airbyte_cdk/utils/spec_schema_transformations.py,sha256=9YDJmnIGFsT51CVQf2tSSvTapGimITjEFGbUTSZAGTI,963
|
458
458
|
airbyte_cdk/utils/stream_status_utils.py,sha256=ZmBoiy5HVbUEHAMrUONxZvxnvfV9CesmQJLDTAIWnWw,1171
|
459
459
|
airbyte_cdk/utils/traced_exception.py,sha256=C8uIBuCL_E4WnBAOPSxBicD06JAldoN9fGsQDp463OY,6292
|
460
|
-
airbyte_cdk-7.1.
|
461
|
-
airbyte_cdk-7.1.
|
462
|
-
airbyte_cdk-7.1.
|
463
|
-
airbyte_cdk-7.1.
|
464
|
-
airbyte_cdk-7.1.
|
465
|
-
airbyte_cdk-7.1.
|
460
|
+
airbyte_cdk-7.1.1.post4.dev18076498401.dist-info/LICENSE.txt,sha256=Wfe61S4BaGPj404v8lrAbvhjYR68SHlkzeYrg3_bbuM,1051
|
461
|
+
airbyte_cdk-7.1.1.post4.dev18076498401.dist-info/LICENSE_SHORT,sha256=aqF6D1NcESmpn-cqsxBtszTEnHKnlsp8L4x9wAh3Nxg,55
|
462
|
+
airbyte_cdk-7.1.1.post4.dev18076498401.dist-info/METADATA,sha256=IeLHXgVZgmlatvZgny4BOEhym1nTHy0SiKccKa17HIs,6819
|
463
|
+
airbyte_cdk-7.1.1.post4.dev18076498401.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
464
|
+
airbyte_cdk-7.1.1.post4.dev18076498401.dist-info/entry_points.txt,sha256=eLZ2UYvJZGm1s07Pplcs--1Gim60YhZWTb53j_dghwU,195
|
465
|
+
airbyte_cdk-7.1.1.post4.dev18076498401.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|