-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
44 additions
and
14 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
...ons/connectors/source-jira/source_jira/components/issues_child_streams_state_migration.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Copyright (c) 2024 Airbyte, Inc., all rights reserved. | ||
|
||
from typing import Any, Mapping | ||
|
||
from airbyte_cdk.sources.declarative.migrations.state_migration import StateMigration | ||
|
||
|
||
class IssuesChildStreamsStateMigration(StateMigration): | ||
""" | ||
Migrate threads state | ||
""" | ||
|
||
def should_migrate(self, stream_state: Mapping[str, Any]) -> bool: | ||
""" | ||
Check if the stream_state should be migrated | ||
:param stream_state: The stream_state to potentially migrate | ||
:return: true if the state is of the expected format and should be migrated. False otherwise. | ||
""" | ||
return "state" not in stream_state and "updated" in stream_state | ||
|
||
def migrate(self, stream_state: Mapping[str, Any]) -> Mapping[str, Any]: | ||
""" | ||
Migrate the stream_state. Assumes should_migrate(stream_state) returned True. | ||
:param stream_state: The stream_state to migrate | ||
:return: The migrated stream_state | ||
""" | ||
migrated_stream_state = {"state": {"updated": stream_state["updated"]}, "parent_state": {"issues": {"states": []}}} | ||
return migrated_stream_state |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters