Skip to content

Commit

Permalink
jdbc build fixes (#10799)
Browse files Browse the repository at this point in the history
  • Loading branch information
edgao authored and etsybaev committed Mar 5, 2022
1 parent 9f7e2dd commit 9121a1e
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import io.airbyte.protocol.models.JsonSchemaType;
import java.io.File;
import java.io.IOException;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;
Expand Down Expand Up @@ -74,7 +75,7 @@ protected Database setupDatabase() throws Exception {
config.get("database").asText()),
"com.mysql.cj.jdbc.Driver",
SQLDialect.MYSQL,
"zeroDateTimeBehavior=convertToNull");
Map.of("zeroDateTimeBehavior", "convertToNull"));

// It disable strict mode in the DB and allows to insert specific values.
// For example, it's possible to insert date with zero values "2021-00-00"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import io.airbyte.integrations.source.mysql.MySqlSource.ReplicationMethod;
import io.airbyte.integrations.standardtest.source.TestDestinationEnv;
import io.airbyte.integrations.standardtest.source.performancetest.AbstractSourceFillDbWithTestData;
import java.util.Map;
import java.util.stream.Stream;
import org.jooq.SQLDialect;
import org.junit.jupiter.api.BeforeAll;
Expand All @@ -35,7 +36,7 @@ protected String getImageName() {
}

@Override
protected Database setupDatabase(String dbName) throws Exception {
protected Database setupDatabase(final String dbName) throws Exception {
config = Jsons.jsonNode(ImmutableMap.builder()
.put("host", "your_host")
.put("port", 3306)
Expand All @@ -54,7 +55,7 @@ protected Database setupDatabase(String dbName) throws Exception {
dbName),
"com.mysql.cj.jdbc.Driver",
SQLDialect.MYSQL,
"zeroDateTimeBehavior=convertToNull");
Map.of("zeroDateTimeBehavior", "convertToNull"));

// It disable strict mode in the DB and allows to insert specific values.
// For example, it's possible to insert date with zero values "2021-00-00"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import io.airbyte.db.Databases;
import io.airbyte.integrations.standardtest.source.performancetest.AbstractSourcePerformanceTest;
import java.nio.file.Path;
import java.util.Map;
import java.util.stream.Stream;
import org.jooq.SQLDialect;
import org.junit.jupiter.api.BeforeAll;
Expand All @@ -27,8 +28,8 @@ protected String getImageName() {
}

@Override
protected void setupDatabase(String dbName) throws Exception {
JsonNode plainConfig = Jsons.deserialize(IOs.readFile(Path.of(PERFORMANCE_SECRET_CREDS)));
protected void setupDatabase(final String dbName) throws Exception {
final JsonNode plainConfig = Jsons.deserialize(IOs.readFile(Path.of(PERFORMANCE_SECRET_CREDS)));

config = Jsons.jsonNode(ImmutableMap.builder()
.put("host", plainConfig.get("host"))
Expand All @@ -48,7 +49,7 @@ protected void setupDatabase(String dbName) throws Exception {
dbName),
"com.mysql.cj.jdbc.Driver",
SQLDialect.MYSQL,
"zeroDateTimeBehavior=convertToNull");
Map.of("zeroDateTimeBehavior", "convertToNull"));

// It disable strict mode in the DB and allows to insert specific values.
// For example, it's possible to insert date with zero values "2021-00-00"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import io.airbyte.protocol.models.SyncMode;
import java.nio.file.Path;
import java.util.HashMap;
import java.util.Map;
import org.apache.commons.lang3.RandomStringUtils;

public class SnowflakeSourceAcceptanceTest extends SourceAcceptanceTest {
Expand Down Expand Up @@ -96,10 +97,9 @@ protected void setupEnvironment(final TestDestinationEnv environment) throws Exc
String.format("jdbc:snowflake://%s/",
config.get("host").asText()),
SnowflakeSource.DRIVER_CLASS,
String.format("role=%s;warehouse=%s;database=%s",
config.get("role").asText(),
config.get("warehouse").asText(),
config.get("database").asText()));
Map.of("role", config.get("role").asText(),
"warehouse", config.get("warehouse").asText(),
"database", config.get("database").asText()));

final String createSchemaQuery = String.format("CREATE SCHEMA IF NOT EXISTS %s", SCHEMA_NAME);
final String createTableQuery1 = String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import io.airbyte.integrations.standardtest.source.TestDestinationEnv;
import io.airbyte.protocol.models.JsonSchemaType;
import java.nio.file.Path;
import java.util.Map;
import org.apache.commons.lang3.RandomStringUtils;
import org.jooq.SQLDialect;

Expand Down Expand Up @@ -56,10 +57,11 @@ private Database getDatabase() {
config.get("host").asText()),
SnowflakeSource.DRIVER_CLASS,
SQLDialect.DEFAULT,
String.format("role=%s;warehouse=%s;database=%s",
config.get("role").asText(),
config.get("warehouse").asText(),
config.get("database").asText()));
Map.of(
"role", config.get("role").asText(),
"warehouse", config.get("warehouse").asText(),
"database", config.get("database").asText()
));
}

@Override
Expand Down

0 comments on commit 9121a1e

Please sign in to comment.