Skip to content
This repository has been archived by the owner on Jun 6, 2023. It is now read-only.

Commit

Permalink
Add Incremental to AbstractJdbcSource (airbytehq#1306)
Browse files Browse the repository at this point in the history
* Add standard tests for sources that use the JdbcSource to guarantee that changes do not break any sources that rely on JdbcSource.

* Add JdbcStressTest to verify that we stream / chunk data properly (a.k.a can handle more data in any JdbcSource than fits in memory)

* Migrate MSSQL and Redshift to user the new base source
  • Loading branch information
cgardens authored Dec 18, 2020
1 parent 6ef6f46 commit 8347a69
Show file tree
Hide file tree
Showing 31 changed files with 2,189 additions and 562 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
"sourceDefinitionId": "b5ea17b1-f170-46dc-bc31-cc744ca984c1",
"name": "Microsoft SQL Server (MSSQL)",
"dockerRepository": "airbyte/source-mssql",
"dockerImageTag": "0.1.5",
"dockerImageTag": "0.1.6",
"documentationUrl": "https://hub.docker.com/r/airbyte/source-mssql"
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
"sourceDefinitionId": "e87ffa8e-a3b5-f69c-9076-6011339de1f6",
"name": "Redshift",
"dockerRepository": "airbyte/source-redshift",
"dockerImageTag": "0.1.0",
"dockerImageTag": "0.1.1",
"documentationUrl": "https://hub.docker.com/repository/docker/airbyte/source-redshift"
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
- sourceDefinitionId: b5ea17b1-f170-46dc-bc31-cc744ca984c1
name: Microsoft SQL Server (MSSQL)
dockerRepository: airbyte/source-mssql
dockerImageTag: 0.1.5
dockerImageTag: 0.1.6
documentationUrl: https://hub.docker.com/r/airbyte/source-mssql
- sourceDefinitionId: decd338e-5647-4c0b-adf4-da0e75f5a750
name: Postgres
Expand Down Expand Up @@ -96,7 +96,7 @@
- sourceDefinitionId: e87ffa8e-a3b5-f69c-9076-6011339de1f6
name: Redshift
dockerRepository: airbyte/source-redshift
dockerImageTag: 0.1.0
dockerImageTag: 0.1.1
documentationUrl: https://hub.docker.com/repository/docker/airbyte/source-redshift
- sourceDefinitionId: 932e6363-d006-4464-a9f5-102b82e07c06
name: Twilio
Expand Down
2 changes: 1 addition & 1 deletion airbyte-db/src/main/java/io/airbyte/db/jdbc/JdbcUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public class JdbcUtils {
* @return stream of records that the result set is mapped to.
*/
public static <T> Stream<T> toStream(ResultSet resultSet, CheckedFunction<ResultSet, T, SQLException> mapper) {
return StreamSupport.stream(new Spliterators.AbstractSpliterator<T>(Long.MAX_VALUE, Spliterator.ORDERED) {
return StreamSupport.stream(new Spliterators.AbstractSpliterator<>(Long.MAX_VALUE, Spliterator.ORDERED) {

@Override
public boolean tryAdvance(Consumer<? super T> action) {
Expand Down
28 changes: 28 additions & 0 deletions airbyte-integrations/connectors/source-jdbc/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,53 @@ plugins {
id 'application'
id 'airbyte-docker'
id 'airbyte-integration-test-java'
id "java-library"
// https://docs.gradle.org/current/userguide/java_testing.html#sec:java_test_fixtures
id "java-test-fixtures"
id 'com.github.eirnym.js2p' version '1.0'
}

application {
mainClass = 'io.airbyte.integrations.source.jdbc.JdbcSource'
}

project.configurations {
testFixturesImplementation.extendsFrom implementation
testFixturesRuntimeOnly.extendsFrom runtimeOnly
}

dependencies {
implementation project(':airbyte-commons')
implementation project(':airbyte-db')
implementation project(':airbyte-integrations:bases:base-java')
implementation project(':airbyte-protocol:models')

implementation 'org.apache.commons:commons-lang3:3.11'

testImplementation project(':airbyte-test-utils')

testImplementation "org.postgresql:postgresql:42.2.18"
testImplementation "org.testcontainers:postgresql:1.15.1"

integrationTestJavaImplementation project(':airbyte-integrations:bases:standard-source-test')
integrationTestJavaImplementation "org.testcontainers:postgresql:1.15.1"

testFixturesImplementation project(':airbyte-protocol:models')
testFixturesImplementation project(':airbyte-db')
testFixturesImplementation project(':airbyte-integrations:bases:base-java')
testFixturesImplementation project(':airbyte-integrations:connectors:source-jdbc')

// todo (cgardens) - the java-test-fixtures plugin doesn't by default extend from test.
// we cannot make it depend on the dependencies of source-jdbc:test, because source-jdbc:test
// is going to depend on these fixtures. need to find a way to get fixtures to inherit the
// common test classes without duplicating them. this should be part of whatever solution we
// decide on for a "test-java-lib". the current implementation is leveraging the existing
// plugin, but we can something different if we don't like this tool.
testFixturesRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.4.2'
testFixturesImplementation 'org.junit.jupiter:junit-jupiter-api:5.4.2'
testFixturesImplementation 'org.junit.jupiter:junit-jupiter-params:5.4.2'
testFixturesImplementation group: 'org.mockito', name: 'mockito-junit-jupiter', version: '3.4.6'

implementation files(project(':airbyte-integrations:bases:base-java').airbyteDocker.outputs)
}

Expand Down
Loading

0 comments on commit 8347a69

Please sign in to comment.