Skip to content

Commit

Permalink
source-postgres:just throw a warning if a cursor column contains null…
Browse files Browse the repository at this point in the history
… value (#20192)

* source-postgres:just throw a warning if a cursor column contains null value

* ignore test + update review comment

* use Disabled annotation

* upgrade version

* upgrade version for alloy db strict encrypt as well

* auto-bump connector version

* update definitions

Co-authored-by: Octavia Squidington III <octavia-squidington-iii@users.noreply.github.com>
  • Loading branch information
subodh1810 and octavia-squidington-iii authored Dec 12, 2022
1 parent c950ea6 commit a3708eb
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
- name: AlloyDB for PostgreSQL
sourceDefinitionId: 1fa90628-2b9e-11ed-a261-0242ac120002
dockerRepository: airbyte/source-alloydb
dockerImageTag: 1.0.17
dockerImageTag: 1.0.32
documentationUrl: https://docs.airbyte.com/integrations/sources/alloydb
icon: alloydb.svg
sourceType: database
Expand Down Expand Up @@ -1250,7 +1250,7 @@
- name: Postgres
sourceDefinitionId: decd338e-5647-4c0b-adf4-da0e75f5a750
dockerRepository: airbyte/source-postgres
dockerImageTag: 1.0.31
dockerImageTag: 1.0.32
documentationUrl: https://docs.airbyte.com/integrations/sources/postgres
icon: postgresql.svg
sourceType: database
Expand Down
50 changes: 13 additions & 37 deletions airbyte-config/init/src/main/resources/seed/source_specs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@
supportsNormalization: false
supportsDBT: false
supported_destination_sync_modes: []
- dockerImage: "airbyte/source-alloydb:1.0.17"
- dockerImage: "airbyte/source-alloydb:1.0.32"
spec:
documentationUrl: "https://docs.airbyte.com/integrations/sources/postgres"
connectionSpecification:
Expand Down Expand Up @@ -389,59 +389,47 @@
order: 7
oneOf:
- title: "disable"
additionalProperties: false
additionalProperties: true
description: "Disable SSL."
required:
- "mode"
properties:
mode:
type: "string"
const: "disable"
enum:
- "disable"
default: "disable"
order: 0
- title: "allow"
additionalProperties: false
additionalProperties: true
description: "Allow SSL mode."
required:
- "mode"
properties:
mode:
type: "string"
const: "allow"
enum:
- "allow"
default: "allow"
order: 0
- title: "prefer"
additionalProperties: false
additionalProperties: true
description: "Prefer SSL mode."
required:
- "mode"
properties:
mode:
type: "string"
const: "prefer"
enum:
- "prefer"
default: "prefer"
order: 0
- title: "require"
additionalProperties: false
additionalProperties: true
description: "Require SSL mode."
required:
- "mode"
properties:
mode:
type: "string"
const: "require"
enum:
- "require"
default: "require"
order: 0
- title: "verify-ca"
additionalProperties: false
additionalProperties: true
description: "Verify-ca SSL mode."
required:
- "mode"
Expand All @@ -450,9 +438,6 @@
mode:
type: "string"
const: "verify-ca"
enum:
- "verify-ca"
default: "verify-ca"
order: 0
ca_certificate:
type: "string"
Expand Down Expand Up @@ -483,7 +468,7 @@
airbyte_secret: true
order: 4
- title: "verify-full"
additionalProperties: false
additionalProperties: true
description: "Verify-full SSL mode."
required:
- "mode"
Expand All @@ -492,9 +477,6 @@
mode:
type: "string"
const: "verify-full"
enum:
- "verify-full"
default: "verify-full"
order: 0
ca_certificate:
type: "string"
Expand Down Expand Up @@ -539,9 +521,6 @@
method:
type: "string"
const: "Standard"
enum:
- "Standard"
default: "Standard"
order: 0
- title: "Logical Replication (CDC)"
description: "Logical replication uses the Postgres write-ahead log (WAL)\
Expand All @@ -557,10 +536,7 @@
method:
type: "string"
const: "CDC"
enum:
- "CDC"
default: "CDC"
order: 0
order: 1
plugin:
type: "string"
title: "Plugin"
Expand All @@ -573,21 +549,21 @@
- "pgoutput"
- "wal2json"
default: "pgoutput"
order: 1
order: 2
replication_slot:
type: "string"
title: "Replication Slot"
description: "A plugin logical replication slot. Read about <a href=\"\
https://docs.airbyte.com/integrations/sources/postgres#step-3-create-replication-slot\"\
>replication slots</a>."
order: 2
order: 3
publication:
type: "string"
title: "Publication"
description: "A Postgres publication used for consuming changes. Read\
\ about <a href=\"https://docs.airbyte.com/integrations/sources/postgres#step-4-create-publications-and-replication-identities-for-tables\"\
>publications and replication identities</a>."
order: 3
order: 4
initial_waiting_seconds:
type: "integer"
title: "Initial Waiting Time in Seconds (Advanced)"
Expand All @@ -597,7 +573,7 @@
\ <a href=\"https://docs.airbyte.com/integrations/sources/postgres#step-5-optional-set-up-initial-waiting-time\"\
>initial waiting time</a>."
default: 300
order: 4
order: 5
min: 120
max: 1200
tunnel_method:
Expand Down Expand Up @@ -11346,7 +11322,7 @@
supportsNormalization: false
supportsDBT: false
supported_destination_sync_modes: []
- dockerImage: "airbyte/source-postgres:1.0.31"
- dockerImage: "airbyte/source-postgres:1.0.32"
spec:
documentationUrl: "https://docs.airbyte.com/integrations/sources/postgres"
connectionSpecification:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ ENV APPLICATION source-alloydb-strict-encrypt

COPY --from=build /airbyte /airbyte

LABEL io.airbyte.version=1.0.17
LABEL io.airbyte.version=1.0.32
LABEL io.airbyte.name=airbyte/source-alloydb-strict-encrypt
2 changes: 1 addition & 1 deletion airbyte-integrations/connectors/source-alloydb/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ ENV APPLICATION source-alloydb

COPY --from=build /airbyte /airbyte

LABEL io.airbyte.version=1.0.17
LABEL io.airbyte.version=1.0.32
LABEL io.airbyte.name=airbyte/source-alloydb
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ ENV APPLICATION source-postgres-strict-encrypt

COPY --from=build /airbyte /airbyte

LABEL io.airbyte.version=1.0.31
LABEL io.airbyte.version=1.0.32
LABEL io.airbyte.name=airbyte/source-postgres-strict-encrypt
2 changes: 1 addition & 1 deletion airbyte-integrations/connectors/source-postgres/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ ENV APPLICATION source-postgres

COPY --from=build /airbyte /airbyte

LABEL io.airbyte.version=1.0.31
LABEL io.airbyte.version=1.0.32
LABEL io.airbyte.name=airbyte/source-postgres
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.testcontainers.containers.PostgreSQLContainer;
import org.testcontainers.utility.MountableFile;
Expand Down Expand Up @@ -545,6 +546,7 @@ private JsonNode buildConfigEscapingNeeded() {
}

@Test
@Disabled("See https://github.com/airbytehq/airbyte/issues/17150#issuecomment-1342898439, enable once communication is out")
public void tableWithNullValueCursorShouldThrowException() throws SQLException {
try (final PostgreSQLContainer<?> db = new PostgreSQLContainer<>("postgres:13-alpine")) {
db.start();
Expand Down Expand Up @@ -586,6 +588,7 @@ private ConfiguredAirbyteStream createTableWithNullValueCursor(final Database da
}

@Test
@Disabled("See https://github.com/airbytehq/airbyte/issues/17150#issuecomment-1342898439, enable once communication is out")
public void viewWithNullValueCursorShouldThrowException() throws SQLException {
try (final PostgreSQLContainer<?> db = new PostgreSQLContainer<>("postgres:13-alpine")) {
db.start();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ private void validateCursorFieldForIncrementalTables(
final Map<String, TableInfo<CommonField<DataType>>> tableNameToTable,
final ConfiguredAirbyteCatalog catalog, final Database database) throws SQLException {
final List<InvalidCursorInfo> tablesWithInvalidCursor = new ArrayList<>();
final List<InvalidCursorInfo> tablesWithInvalidCursorToWarnAbout = new ArrayList<>();
for (final ConfiguredAirbyteStream airbyteStream : catalog.getStreams()) {
final AirbyteStream stream = airbyteStream.getStream();
final String fullyQualifiedTableName = getFullyQualifiedTableName(stream.getNamespace(),
Expand Down Expand Up @@ -216,13 +217,16 @@ private void validateCursorFieldForIncrementalTables(
}

if (!verifyCursorColumnValues(database, stream.getNamespace(), stream.getName(), cursorField.get())) {
tablesWithInvalidCursor.add(
tablesWithInvalidCursorToWarnAbout.add(
new InvalidCursorInfo(fullyQualifiedTableName, cursorField.get(),
cursorType.toString(), "Cursor column contains NULL value"));
continue;
}
}

if (!tablesWithInvalidCursorToWarnAbout.isEmpty()) {
LOGGER.warn("source-postgres detected null cursor value " + InvalidCursorInfoUtil.getInvalidCursorConfigMessage(tablesWithInvalidCursor));
}

if (!tablesWithInvalidCursor.isEmpty()) {
throw new ConfigErrorException(
InvalidCursorInfoUtil.getInvalidCursorConfigMessage(tablesWithInvalidCursor));
Expand Down
1 change: 1 addition & 0 deletions docs/integrations/sources/postgres.md
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,7 @@ The root causes is that the WALs needed for the incremental sync has been remove

| Version | Date | Pull Request | Subject |
|:--------|:-----------|:-----------------------------------------------------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| 1.0.32 | 2022-12-12 | [20192](https://github.com/airbytehq/airbyte/pull/20192) | Only throw a warning if cursor column contains null values. |
| 1.0.31 | 2022-12-02 | [19889](https://github.com/airbytehq/airbyte/pull/19889) | Check before each sync and stop if an incremental sync cursor column contains a null value. |
| | 2022-12-02 | [19985](https://github.com/airbytehq/airbyte/pull/19985) | Reenable incorrectly-disabled `wal2json` CDC plugin |
| 1.0.30 | 2022-11-29 | [19024](https://github.com/airbytehq/airbyte/pull/19024) | Skip tables from schema where user do not have Usage permission during discovery. |
Expand Down

0 comments on commit a3708eb

Please sign in to comment.