Skip to content

Commit 28a6add

Browse files
MSSQL Source : Standardize spec.json for DB connectors that support log-based CDC replication (#16215)
* Fixed bucket naming for S3 * removed redundant configs * MSSQL Source : Standardize spec.json for DB connectors that support log-based CDC replication * bump version * bump version
1 parent b9a7df1 commit 28a6add

File tree

13 files changed

+50
-40
lines changed

13 files changed

+50
-40
lines changed

airbyte-config/init/src/main/resources/seed/source_definitions.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,7 @@
599599
- name: Microsoft SQL Server (MSSQL)
600600
sourceDefinitionId: b5ea17b1-f170-46dc-bc31-cc744ca984c1
601601
dockerRepository: airbyte/source-mssql
602-
dockerImageTag: 0.4.17
602+
dockerImageTag: 0.4.18
603603
documentationUrl: https://docs.airbyte.io/integrations/sources/mssql
604604
icon: mssql.svg
605605
sourceType: database

airbyte-config/init/src/main/resources/seed/source_specs.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5273,7 +5273,7 @@
52735273
supportsNormalization: false
52745274
supportsDBT: false
52755275
supported_destination_sync_modes: []
5276-
- dockerImage: "airbyte/source-mssql:0.4.17"
5276+
- dockerImage: "airbyte/source-mssql:0.4.18"
52775277
spec:
52785278
documentationUrl: "https://docs.airbyte.io/integrations/destinations/mssql"
52795279
connectionSpecification:
@@ -5374,7 +5374,7 @@
53745374
description: "Specifies the host name of the server. The value of\
53755375
\ this property must match the subject property of the certificate."
53765376
order: 7
5377-
replication:
5377+
replication_method:
53785378
type: "object"
53795379
title: "Replication Method"
53805380
description: "The replication method used for extracting data from the database.\
@@ -5389,9 +5389,9 @@
53895389
description: "Standard replication requires no setup on the DB side but\
53905390
\ will not be able to represent deletions incrementally."
53915391
required:
5392-
- "replication_type"
5392+
- "method"
53935393
properties:
5394-
replication_type:
5394+
method:
53955395
type: "string"
53965396
const: "STANDARD"
53975397
enum:
@@ -5402,9 +5402,9 @@
54025402
description: "CDC uses {TBC} to detect inserts, updates, and deletes.\
54035403
\ This needs to be configured on the source database itself."
54045404
required:
5405-
- "replication_type"
5405+
- "method"
54065406
properties:
5407-
replication_type:
5407+
method:
54085408
type: "string"
54095409
const: "CDC"
54105410
enum:

airbyte-integrations/connectors/source-mssql-strict-encrypt/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@ ENV APPLICATION source-mssql-strict-encrypt
1616

1717
COPY --from=build /airbyte /airbyte
1818

19-
LABEL io.airbyte.version=0.4.17
19+
LABEL io.airbyte.version=0.4.18
2020
LABEL io.airbyte.name=airbyte/source-mssql-strict-encrypt

airbyte-integrations/connectors/source-mssql-strict-encrypt/src/test/resources/expected_spec.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787
}
8888
]
8989
},
90-
"replication": {
90+
"replication_method": {
9191
"type": "object",
9292
"title": "Replication Method",
9393
"description": "The replication method used for extracting data from the database. STANDARD replication requires no setup on the DB side but will not be able to represent deletions incrementally. CDC uses {TBC} to detect inserts, updates, and deletes. This needs to be configured on the source database itself.",
@@ -97,9 +97,9 @@
9797
{
9898
"title": "Standard",
9999
"description": "Standard replication requires no setup on the DB side but will not be able to represent deletions incrementally.",
100-
"required": ["replication_type"],
100+
"required": ["method"],
101101
"properties": {
102-
"replication_type": {
102+
"method": {
103103
"type": "string",
104104
"const": "STANDARD",
105105
"enum": ["STANDARD"],
@@ -111,9 +111,9 @@
111111
{
112112
"title": "Logical Replication (CDC)",
113113
"description": "CDC uses {TBC} to detect inserts, updates, and deletes. This needs to be configured on the source database itself.",
114-
"required": ["replication_type"],
114+
"required": ["method"],
115115
"properties": {
116-
"replication_type": {
116+
"method": {
117117
"type": "string",
118118
"const": "CDC",
119119
"enum": ["CDC"],

airbyte-integrations/connectors/source-mssql/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@ ENV APPLICATION source-mssql
1616

1717
COPY --from=build /airbyte /airbyte
1818

19-
LABEL io.airbyte.version=0.4.17
19+
LABEL io.airbyte.version=0.4.18
2020
LABEL io.airbyte.name=airbyte/source-mssql

airbyte-integrations/connectors/source-mssql/src/main/java/io/airbyte/integrations/source/mssql/MssqlCdcHelper.java

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ public class MssqlCdcHelper {
1717
// it is an oneOf object
1818
private static final String REPLICATION_FIELD = "replication";
1919
private static final String REPLICATION_TYPE_FIELD = "replication_type";
20+
private static final String METHOD_FIELD = "method";
2021
private static final String CDC_SNAPSHOT_ISOLATION_FIELD = "snapshot_isolation";
2122
private static final String CDC_DATA_TO_SYNC_FIELD = "data_to_sync";
2223

@@ -91,14 +92,19 @@ public static DataToSync from(final String value) {
9192
@VisibleForTesting
9293
static boolean isCdc(final JsonNode config) {
9394
// new replication method config since version 0.4.0
94-
if (config.hasNonNull(REPLICATION_FIELD)) {
95-
final JsonNode replicationConfig = config.get(REPLICATION_FIELD);
96-
return ReplicationMethod.valueOf(replicationConfig.get(REPLICATION_TYPE_FIELD).asText()) == ReplicationMethod.CDC;
95+
if (config.hasNonNull(LEGACY_REPLICATION_FIELD) && config.get(LEGACY_REPLICATION_FIELD).isObject()) {
96+
final JsonNode replicationConfig = config.get(LEGACY_REPLICATION_FIELD);
97+
return ReplicationMethod.valueOf(replicationConfig.get(METHOD_FIELD).asText()) == ReplicationMethod.CDC;
9798
}
9899
// legacy replication method config before version 0.4.0
99-
if (config.hasNonNull(LEGACY_REPLICATION_FIELD)) {
100+
if (config.hasNonNull(LEGACY_REPLICATION_FIELD) && config.get(LEGACY_REPLICATION_FIELD).isTextual()) {
100101
return ReplicationMethod.valueOf(config.get(LEGACY_REPLICATION_FIELD).asText()) == ReplicationMethod.CDC;
101102
}
103+
if (config.hasNonNull(REPLICATION_FIELD)) {
104+
final JsonNode replicationConfig = config.get(REPLICATION_FIELD);
105+
return ReplicationMethod.valueOf(replicationConfig.get(REPLICATION_TYPE_FIELD).asText()) == ReplicationMethod.CDC;
106+
}
107+
102108
return false;
103109
}
104110

airbyte-integrations/connectors/source-mssql/src/main/resources/spec.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@
100100
}
101101
]
102102
},
103-
"replication": {
103+
"replication_method": {
104104
"type": "object",
105105
"title": "Replication Method",
106106
"description": "The replication method used for extracting data from the database. STANDARD replication requires no setup on the DB side but will not be able to represent deletions incrementally. CDC uses {TBC} to detect inserts, updates, and deletes. This needs to be configured on the source database itself.",
@@ -110,9 +110,9 @@
110110
{
111111
"title": "Standard",
112112
"description": "Standard replication requires no setup on the DB side but will not be able to represent deletions incrementally.",
113-
"required": ["replication_type"],
113+
"required": ["method"],
114114
"properties": {
115-
"replication_type": {
115+
"method": {
116116
"type": "string",
117117
"const": "STANDARD",
118118
"enum": ["STANDARD"],
@@ -124,9 +124,9 @@
124124
{
125125
"title": "Logical Replication (CDC)",
126126
"description": "CDC uses {TBC} to detect inserts, updates, and deletes. This needs to be configured on the source database itself.",
127-
"required": ["replication_type"],
127+
"required": ["method"],
128128
"properties": {
129-
"replication_type": {
129+
"method": {
130130
"type": "string",
131131
"const": "CDC",
132132
"enum": ["CDC"],

airbyte-integrations/connectors/source-mssql/src/test-integration/java/io/airbyte/integrations/source/mssql/CdcMssqlSourceAcceptanceTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ protected void setupEnvironment(final TestDestinationEnv environment) throws Int
9797
container.start();
9898

9999
final JsonNode replicationConfig = Jsons.jsonNode(Map.of(
100-
"replication_type", "CDC",
100+
"method", "CDC",
101101
"data_to_sync", "Existing and New",
102102
"snapshot_isolation", "Snapshot"));
103103

@@ -107,7 +107,7 @@ protected void setupEnvironment(final TestDestinationEnv environment) throws Int
107107
.put(JdbcUtils.DATABASE_KEY, DB_NAME)
108108
.put(JdbcUtils.USERNAME_KEY, TEST_USER_NAME)
109109
.put(JdbcUtils.PASSWORD_KEY, TEST_USER_PASSWORD)
110-
.put("replication", replicationConfig)
110+
.put("replication_method", replicationConfig)
111111
.build());
112112

113113
dslContext = DSLContextFactory.create(

airbyte-integrations/connectors/source-mssql/src/test-integration/java/io/airbyte/integrations/source/mssql/CdcMssqlSourceDatatypeTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ protected Database setupDatabase() throws Exception {
3232
container.start();
3333

3434
final JsonNode replicationConfig = Jsons.jsonNode(Map.of(
35-
"replication_type", "CDC",
35+
"method", "CDC",
3636
"data_to_sync", "Existing and New",
3737
"snapshot_isolation", "Snapshot"));
3838

@@ -42,7 +42,7 @@ protected Database setupDatabase() throws Exception {
4242
.put(JdbcUtils.DATABASE_KEY, DB_NAME)
4343
.put(JdbcUtils.USERNAME_KEY, container.getUsername())
4444
.put(JdbcUtils.PASSWORD_KEY, container.getPassword())
45-
.put("replication", replicationConfig)
45+
.put("replication_method", replicationConfig)
4646
.build());
4747

4848
dslContext = DSLContextFactory.create(

airbyte-integrations/connectors/source-mssql/src/test-performance/java/io/airbyte/integrations/source/mssql/FillMsSqlTestDbScriptTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ protected String getImageName() {
4040
@Override
4141
protected Database setupDatabase(final String dbName) {
4242
final JsonNode replicationMethod = Jsons.jsonNode(ImmutableMap.builder()
43-
.put("replication_type", "Standard")
43+
.put("method", "Standard")
4444
.build());
4545

4646
config = Jsons.jsonNode(ImmutableMap.builder()
@@ -49,7 +49,7 @@ protected Database setupDatabase(final String dbName) {
4949
.put(JdbcUtils.DATABASE_KEY, dbName) // set your db name
5050
.put(JdbcUtils.USERNAME_KEY, "your_username")
5151
.put(JdbcUtils.PASSWORD_KEY, "your_pass")
52-
.put("replication", replicationMethod)
52+
.put("replication_method", replicationMethod)
5353
.build());
5454

5555
dslContext = DSLContextFactory.create(

0 commit comments

Comments
 (0)