forked from airbytehq/airbyte
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Checkpointing source-mssql (airbytehq#34182)
Co-authored-by: nguyenaiden <duy@airbyte.io> Co-authored-by: Xiaohan Song <xiaohan@airbyte.io> Co-authored-by: Marius Posta <marius@airbyte.io>
- Loading branch information
1 parent
acb425b
commit aaacfe6
Showing
45 changed files
with
2,742 additions
and
253 deletions.
There are no files selected for viewing
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
2 changes: 1 addition & 1 deletion
2
airbyte-cdk/java/airbyte-cdk/core/src/main/resources/version.properties
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 |
---|---|---|
@@ -1 +1 @@ | ||
version=0.17.1 | ||
version=0.18.0 |
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
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
49 changes: 49 additions & 0 deletions
49
...s/src/main/java/io/airbyte/cdk/integrations/source/relationaldb/RelationalDbReadUtil.java
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,49 @@ | ||
/* | ||
* Copyright (c) 2023 Airbyte, Inc., all rights reserved. | ||
*/ | ||
|
||
package io.airbyte.cdk.integrations.source.relationaldb; | ||
|
||
import com.google.common.collect.Sets; | ||
import io.airbyte.commons.json.Jsons; | ||
import io.airbyte.protocol.models.v0.AirbyteStreamNameNamespacePair; | ||
import io.airbyte.protocol.models.v0.ConfiguredAirbyteCatalog; | ||
import io.airbyte.protocol.models.v0.ConfiguredAirbyteStream; | ||
import io.airbyte.protocol.models.v0.SyncMode; | ||
import java.util.HashSet; | ||
import java.util.List; | ||
import java.util.Set; | ||
import java.util.stream.Collectors; | ||
|
||
public class RelationalDbReadUtil { | ||
|
||
public static List<ConfiguredAirbyteStream> identifyStreamsToSnapshot(final ConfiguredAirbyteCatalog catalog, | ||
final Set<AirbyteStreamNameNamespacePair> alreadySyncedStreams) { | ||
final Set<AirbyteStreamNameNamespacePair> allStreams = AirbyteStreamNameNamespacePair.fromConfiguredCatalog(catalog); | ||
final Set<AirbyteStreamNameNamespacePair> newlyAddedStreams = new HashSet<>(Sets.difference(allStreams, alreadySyncedStreams)); | ||
return catalog.getStreams().stream() | ||
.filter(c -> c.getSyncMode() == SyncMode.INCREMENTAL) | ||
.filter(stream -> newlyAddedStreams.contains(AirbyteStreamNameNamespacePair.fromAirbyteStream(stream.getStream()))) | ||
.map(Jsons::clone) | ||
.collect(Collectors.toList()); | ||
} | ||
|
||
public static List<ConfiguredAirbyteStream> identifyStreamsForCursorBased(final ConfiguredAirbyteCatalog catalog, | ||
final List<ConfiguredAirbyteStream> streamsForInitialLoad) { | ||
|
||
final Set<AirbyteStreamNameNamespacePair> initialLoadStreamsNamespacePairs = | ||
streamsForInitialLoad.stream().map(stream -> AirbyteStreamNameNamespacePair.fromAirbyteStream(stream.getStream())) | ||
.collect( | ||
Collectors.toSet()); | ||
return catalog.getStreams().stream() | ||
.filter(c -> c.getSyncMode() == SyncMode.INCREMENTAL) | ||
.filter(stream -> !initialLoadStreamsNamespacePairs.contains(AirbyteStreamNameNamespacePair.fromAirbyteStream(stream.getStream()))) | ||
.map(Jsons::clone) | ||
.collect(Collectors.toList()); | ||
} | ||
|
||
public static AirbyteStreamNameNamespacePair convertNameNamespacePairFromV0(final io.airbyte.protocol.models.AirbyteStreamNameNamespacePair v1NameNamespacePair) { | ||
return new AirbyteStreamNameNamespacePair(v1NameNamespacePair.getName(), v1NameNamespacePair.getNamespace()); | ||
} | ||
|
||
} |
49 changes: 49 additions & 0 deletions
49
airbyte-cdk/java/airbyte-cdk/db-sources/src/main/resources/db_models/internal_models.yaml
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,49 @@ | ||
--- | ||
"$schema": http://json-schema.org/draft-07/schema# | ||
title: DbSource Models | ||
type: object | ||
description: DbSource Models | ||
properties: | ||
state_type: | ||
"$ref": "#/definitions/StateType" | ||
ordered_column_state: | ||
"$ref": "#/definitions/OrderedColumnLoadStatus" | ||
cursor_based_state: | ||
"$ref": "#/definitions/CursorBasedStatus" | ||
definitions: | ||
StateType: | ||
description: Enum to define the sync mode of stream state. | ||
type: string | ||
enum: | ||
- cursor_based | ||
- ordered_column | ||
- cdc | ||
CursorBasedStatus: | ||
type: object | ||
extends: | ||
type: object | ||
existingJavaType: "io.airbyte.cdk.integrations.source.relationaldb.models.DbStreamState" | ||
properties: | ||
state_type: | ||
"$ref": "#/definitions/StateType" | ||
version: | ||
description: Version of state. | ||
type: integer | ||
OrderedColumnLoadStatus: | ||
type: object | ||
properties: | ||
version: | ||
description: Version of state. | ||
type: integer | ||
state_type: | ||
"$ref": "#/definitions/StateType" | ||
ordered_col: | ||
description: ordered column name | ||
type: string | ||
ordered_col_val: | ||
description: ordered column high watermark | ||
type: string | ||
incremental_state: | ||
description: State to switch to after completion of the ordered column initial sync | ||
type: object | ||
existingJavaType: com.fasterxml.jackson.databind.JsonNode |
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
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
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
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
Oops, something went wrong.