Skip to content

Commit 84d1456

Browse files
JDBC sources: update for sources that not have permissions issues (#10173)
* JDBC sources: update for sources that not have permissions issues * Postgres, CockroachDB and DB2 sources: updated case when user has none permitted table * Postgres, CockroachDB and DB2 sources: updated case when user has none permitted table * Postgres, CockroachDB and DB2 sources: bump versions * Postgres, CockroachDB and DB2 sources: bump source specs * Postgres, CockroachDB and DB2 sources: revert changes for postgres-strict-encrypt
1 parent e178567 commit 84d1456

File tree

17 files changed

+40
-16
lines changed

17 files changed

+40
-16
lines changed

airbyte-config/init/src/main/resources/config/STANDARD_SOURCE_DEFINITION/447e0381-3780-4b46-bb62-00a4e3c8b8e2.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"sourceDefinitionId": "447e0381-3780-4b46-bb62-00a4e3c8b8e2",
33
"name": "IBM Db2",
44
"dockerRepository": "airbyte/source-db2",
5-
"dockerImageTag": "0.1.5",
5+
"dockerImageTag": "0.1.6",
66
"documentationUrl": "https://docs.airbyte.io/integrations/sources/db2",
77
"icon": "db2.svg"
88
}

airbyte-config/init/src/main/resources/config/STANDARD_SOURCE_DEFINITION/9fa5862c-da7c-11eb-8d19-0242ac130003.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"sourceDefinitionId": "9fa5862c-da7c-11eb-8d19-0242ac130003",
33
"name": "Cockroachdb",
44
"dockerRepository": "airbyte/source-cockroachdb",
5-
"dockerImageTag": "0.1.5",
5+
"dockerImageTag": "0.1.6",
66
"documentationUrl": "https://docs.airbyte.io/integrations/sources/cockroachdb",
77
"icon": "cockroachdb.svg"
88
}

airbyte-config/init/src/main/resources/config/STANDARD_SOURCE_DEFINITION/decd338e-5647-4c0b-adf4-da0e75f5a750.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"sourceDefinitionId": "decd338e-5647-4c0b-adf4-da0e75f5a750",
33
"name": "Postgres",
44
"dockerRepository": "airbyte/source-postgres",
5-
"dockerImageTag": "0.4.4",
5+
"dockerImageTag": "0.4.5",
66
"documentationUrl": "https://docs.airbyte.io/integrations/sources/postgres",
77
"icon": "postgresql.svg"
88
}

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@
140140
- name: Cockroachdb
141141
sourceDefinitionId: 9fa5862c-da7c-11eb-8d19-0242ac130003
142142
dockerRepository: airbyte/source-cockroachdb
143-
dockerImageTag: 0.1.5
143+
dockerImageTag: 0.1.6
144144
documentationUrl: https://docs.airbyte.io/integrations/sources/cockroachdb
145145
icon: cockroachdb.svg
146146
sourceType: database
@@ -321,7 +321,7 @@
321321
- name: IBM Db2
322322
sourceDefinitionId: 447e0381-3780-4b46-bb62-00a4e3c8b8e2
323323
dockerRepository: airbyte/source-db2
324-
dockerImageTag: 0.1.5
324+
dockerImageTag: 0.1.6
325325
documentationUrl: https://docs.airbyte.io/integrations/sources/db2
326326
icon: db2.svg
327327
sourceType: database
@@ -578,7 +578,7 @@
578578
- name: Postgres
579579
sourceDefinitionId: decd338e-5647-4c0b-adf4-da0e75f5a750
580580
dockerRepository: airbyte/source-postgres
581-
dockerImageTag: 0.4.4
581+
dockerImageTag: 0.4.5
582582
documentationUrl: https://docs.airbyte.io/integrations/sources/postgres
583583
icon: postgresql.svg
584584
sourceType: database

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -1205,7 +1205,7 @@
12051205
supportsNormalization: false
12061206
supportsDBT: false
12071207
supported_destination_sync_modes: []
1208-
- dockerImage: "airbyte/source-cockroachdb:0.1.5"
1208+
- dockerImage: "airbyte/source-cockroachdb:0.1.6"
12091209
spec:
12101210
documentationUrl: "https://docs.airbyte.io/integrations/sources/cockroachdb"
12111211
connectionSpecification:
@@ -3171,7 +3171,7 @@
31713171
- - "client_secret"
31723172
oauthFlowOutputParameters:
31733173
- - "refresh_token"
3174-
- dockerImage: "airbyte/source-db2:0.1.5"
3174+
- dockerImage: "airbyte/source-db2:0.1.6"
31753175
spec:
31763176
documentationUrl: "https://docs.airbyte.io/integrations/sources/db2"
31773177
connectionSpecification:
@@ -5942,7 +5942,7 @@
59425942
supportsNormalization: false
59435943
supportsDBT: false
59445944
supported_destination_sync_modes: []
5945-
- dockerImage: "airbyte/source-postgres:0.4.4"
5945+
- dockerImage: "airbyte/source-postgres:0.4.5"
59465946
spec:
59475947
documentationUrl: "https://docs.airbyte.com/integrations/sources/postgres"
59485948
connectionSpecification:

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@ ENV APPLICATION source-cockroachdb-strict-encrypt
1616

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

19-
LABEL io.airbyte.version=0.1.2
19+
LABEL io.airbyte.version=0.1.3
2020
LABEL io.airbyte.name=airbyte/source-cockroachdb-strict-encrypt

airbyte-integrations/connectors/source-cockroachdb/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@ ENV APPLICATION source-cockroachdb
1616

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

19-
LABEL io.airbyte.version=0.1.5
19+
LABEL io.airbyte.version=0.1.6
2020
LABEL io.airbyte.name=airbyte/source-cockroachdb

airbyte-integrations/connectors/source-cockroachdb/src/main/java/io/airbyte/integrations/source/cockroachdb/CockroachDbSource.java

+5
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,11 @@ public Set<JdbcPrivilegeDto> getPrivilegesTableForCurrentUser(final JdbcDatabase
105105
.collect(Collectors.toSet());
106106
}
107107

108+
@Override
109+
protected boolean isNotInternalSchema(JsonNode jsonNode, Set<String> internalSchemas) {
110+
return false;
111+
}
112+
108113
private CheckedFunction<Connection, PreparedStatement, SQLException> getPrivileges(JdbcDatabase database) {
109114
return connection -> {
110115
final PreparedStatement ps = connection.prepareStatement(

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@ ENV APPLICATION source-db2-strict-encrypt
1616

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

19-
LABEL io.airbyte.version=0.1.2
19+
LABEL io.airbyte.version=0.1.3
2020
LABEL io.airbyte.name=airbyte/source-db2-strict-encrypt

airbyte-integrations/connectors/source-db2/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@ ENV APPLICATION source-db2
1616

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

19-
LABEL io.airbyte.version=0.1.5
19+
LABEL io.airbyte.version=0.1.6
2020
LABEL io.airbyte.name=airbyte/source-db2

airbyte-integrations/connectors/source-db2/src/main/java/io.airbyte.integrations.source.db2/Db2Source.java

+5
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,11 @@ public Set<JdbcPrivilegeDto> getPrivilegesTableForCurrentUser(final JdbcDatabase
9595
.collect(Collectors.toSet());
9696
}
9797

98+
@Override
99+
protected boolean isNotInternalSchema(JsonNode jsonNode, Set<String> internalSchemas) {
100+
return false;
101+
}
102+
98103
private CheckedFunction<Connection, PreparedStatement, SQLException> getPrivileges() {
99104
return connection -> connection.prepareStatement(
100105
"SELECT DISTINCT OBJECTNAME, OBJECTSCHEMA FROM SYSIBMADM.PRIVILEGES WHERE OBJECTTYPE = 'TABLE' AND PRIVILEGE = 'SELECT' AND AUTHID = SESSION_USER");

airbyte-integrations/connectors/source-jdbc/src/main/java/io/airbyte/integrations/source/jdbc/AbstractJdbcSource.java

+7-2
Original file line numberDiff line numberDiff line change
@@ -146,11 +146,11 @@ protected List<TableInfo<CommonField<Datatype>>> discoverInternal(final JdbcData
146146
.collect(Collectors.toList());
147147
}
148148

149-
private Predicate<JsonNode> excludeNotAccessibleTables(final Set<String> internalSchemas,
149+
protected Predicate<JsonNode> excludeNotAccessibleTables(final Set<String> internalSchemas,
150150
final Set<JdbcPrivilegeDto> tablesWithSelectGrantPrivilege) {
151151
return jsonNode -> {
152152
if (tablesWithSelectGrantPrivilege.isEmpty()) {
153-
return false;
153+
return isNotInternalSchema(jsonNode, internalSchemas);
154154
}
155155
return tablesWithSelectGrantPrivilege.stream()
156156
.anyMatch(e -> e.getSchemaName().equals(jsonNode.get(INTERNAL_SCHEMA_NAME).asText()))
@@ -160,6 +160,11 @@ private Predicate<JsonNode> excludeNotAccessibleTables(final Set<String> interna
160160
};
161161
}
162162

163+
// needs to override isNotInternalSchema for connectors that override getPrivilegesTableForCurrentUser()
164+
protected boolean isNotInternalSchema(JsonNode jsonNode, Set<String> internalSchemas) {
165+
return !internalSchemas.contains(jsonNode.get(INTERNAL_SCHEMA_NAME).asText());
166+
}
167+
163168
/**
164169
* @param resultSet Description of a column available in the table catalog.
165170
* @return Essential information about a column to determine which table it belongs to and its type.

airbyte-integrations/connectors/source-postgres/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@ ENV APPLICATION source-postgres
1616

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

19-
LABEL io.airbyte.version=0.4.4
19+
LABEL io.airbyte.version=0.4.5
2020
LABEL io.airbyte.name=airbyte/source-postgres

airbyte-integrations/connectors/source-postgres/src/main/java/io/airbyte/integrations/source/postgres/PostgresSource.java

+5
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,11 @@ public Set<JdbcPrivilegeDto> getPrivilegesTableForCurrentUser(final JdbcDatabase
323323
.collect(toSet());
324324
}
325325

326+
@Override
327+
protected boolean isNotInternalSchema(JsonNode jsonNode, Set<String> internalSchemas) {
328+
return false;
329+
}
330+
326331
/*
327332
* Set all streams that do have incremental to sourceDefined, so that the user cannot set or
328333
* override a cursor field.

docs/integrations/sources/cockroachdb.md

+2
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ Your database user should now be ready for use with Airbyte.
9595

9696
| Version | Date | Pull Request | Subject |
9797
| :--- | :--- | :--- | :--- |
98+
| 0.1.6 | 2022-02-08 | [10173](https://github.com/airbytehq/airbyte/pull/10173) | Improved discovering tables in case if user does not have permissions to any table |
9899
| 0.1.5 | 2021-12-24 | [9004](https://github.com/airbytehq/airbyte/pull/9004) | User can see only permmited tables during discovery |
99100
| 0.1.4 | 2021-12-24 | [8958](https://github.com/airbytehq/airbyte/pull/8958) | Add support for JdbcType.ARRAY |
100101
| 0.1.3 | 2021-10-10 | [7819](https://github.com/airbytehq/airbyte/pull/7819) | Fixed Datatype errors during Cockroach DB parsing |
@@ -104,6 +105,7 @@ Your database user should now be ready for use with Airbyte.
104105

105106
| Version | Date | Pull Request | Subject |
106107
|:--------| :--- | :--- | :--- |
108+
| 0.1.3 | 2022-02-08 | [10173](https://github.com/airbytehq/airbyte/pull/10173) | Improved discovering tables in case if user does not have permissions to any table |
107109
| 0.1.2 | 2021-12-24 | [9004](https://github.com/airbytehq/airbyte/pull/9004) | User can see only permmited tables during discovery |
108110
| 0.1.1 | 2021-12-24 | [8958](https://github.com/airbytehq/airbyte/pull/8958) | Add support for JdbcType.ARRAY |
109111
| 0.1.0 | 2021-11-23 | [7457](https://github.com/airbytehq/airbyte/pull/7457) | CockroachDb source: Add only encrypted version for the connector |

docs/integrations/sources/db2.md

+1
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ You can also enter your own password for the keystore, but if you don't, the pas
6262

6363
| Version | Date | Pull Request | Subject |
6464
| :--- | :--- | :--- | :--- |
65+
| 0.1.6 | 2022-02-08 | [10173](https://github.com/airbytehq/airbyte/pull/10173) | Improved discovering tables in case if user does not have permissions to any table |
6566
| 0.1.5 | 2022-02-01 | [9875](https://github.com/airbytehq/airbyte/pull/9875) | Discover only permitted for user tables |
6667
| 0.1.4 | 2021-12-30 | [9187](https://github.com/airbytehq/airbyte/pull/9187) [8749](https://github.com/airbytehq/airbyte/pull/8749) | Add support of JdbcType.ARRAY to JdbcSourceOperations. |
6768
| 0.1.3 | 2021-11-05 | [7670](https://github.com/airbytehq/airbyte/pull/7670) | Updated unique DB2 types transformation |

docs/integrations/sources/postgres.md

+1
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,7 @@ According to Postgres [documentation](https://www.postgresql.org/docs/14/datatyp
270270

271271
| Version | Date | Pull Request | Subject |
272272
|:--------|:-----------|:-------------------------------------------------------|:----------------------------------------------------------------------------------------------------------------|
273+
| 0.4.5 | 2022-02-08 | [10173](https://github.com/airbytehq/airbyte/pull/10173) | Improved discovering tables in case if user does not have permissions to any table |
273274
| 0.4.4 | 2022-01-26 | [9807](https://github.com/airbytehq/airbyte/pull/9807) | Update connector fields title/description |
274275
| 0.4.3 | 2022-01-24 | [9554](https://github.com/airbytehq/airbyte/pull/9554) | Allow handling of java sql date in CDC |
275276
| 0.4.2 | 2022-01-13 | [9360](https://github.com/airbytehq/airbyte/pull/9360) | Added schema selection |

0 commit comments

Comments
 (0)