Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🎉 Destination MSSQL: added custom JDBC parameters support. #13054

Merged
merged 8 commits into from
Jun 8, 2022
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ ENV APPLICATION destination-mssql-strict-encrypt

COPY --from=build /airbyte /airbyte

LABEL io.airbyte.version=0.1.7
LABEL io.airbyte.version=0.1.8
LABEL io.airbyte.name=airbyte/destination-mssql-strict-encrypt
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ ENV APPLICATION destination-mssql

COPY --from=build /airbyte /airbyte

LABEL io.airbyte.version=0.1.18
LABEL io.airbyte.version=0.1.19
LABEL io.airbyte.name=airbyte/destination-mssql
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ public JsonNode toJdbcConfig(final JsonNode config) {
.put("schema", schema);

if (config.has(JDBC_URL_PARAMS_KEY)) {
configBuilder.put("connection_properties", config.get(JDBC_URL_PARAMS_KEY));
//configBuilder.put("connection_properties", config.get(JDBC_URL_PARAMS_KEY));
configBuilder.put(JDBC_URL_PARAMS_KEY, config.get(JDBC_URL_PARAMS_KEY));
}

return Jsons.jsonNode(configBuilder.build());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@
package io.airbyte.integrations.destination.mssql;

import static java.lang.System.getProperty;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.*;

import com.fasterxml.jackson.databind.JsonNode;
import io.airbyte.commons.json.Jsons;
Expand Down Expand Up @@ -166,4 +163,52 @@ private void resetProperty(final String key) {
}
}

@Test
void testNoExtraParams() {
final JsonNode config = buildConfigNoJdbcParameters();
final JsonNode jdbcConfig = new MSSQLDestination().toJdbcConfig(config);
assertNull(jdbcConfig.get(MSSQLDestination.JDBC_URL_PARAMS_KEY));
}

@Test
void testEmptyExtraParams() {
final String extraParam = "";
JsonNode config = buildConfigWithExtraJdbcParameters(extraParam);
final JsonNode jdbcConfig = new MSSQLDestination().toJdbcConfig(config);
assertNotNull(jdbcConfig.get(MSSQLDestination.JDBC_URL_PARAMS_KEY).asText());
assertEquals(extraParam, jdbcConfig.get(MSSQLDestination.JDBC_URL_PARAMS_KEY).asText());
}

@Test
void testExtraParams() {
final String extraParam = "key1=value1&key2=value2&key3=value3";
JsonNode config = buildConfigWithExtraJdbcParameters(extraParam);
final JsonNode jdbcConfig = new MSSQLDestination().toJdbcConfig(config);
assertNotNull(jdbcConfig.get(MSSQLDestination.JDBC_URL_PARAMS_KEY).asText());
assertEquals(extraParam, jdbcConfig.get(MSSQLDestination.JDBC_URL_PARAMS_KEY).asText());

}

private JsonNode buildConfigNoJdbcParameters() {
return Jsons.jsonNode(com.google.common.collect.ImmutableMap.of(
"ssl_method", "ssl_method",
"host", "localhost",
"port", "1773",
"database", "db",
"username", "username",
"password", "verysecure"));
}

private JsonNode buildConfigWithExtraJdbcParameters(String extraParam) {

return Jsons.jsonNode(com.google.common.collect.ImmutableMap.of(
"ssl_method", "ssl_method",
"host", "localhost",
"port", "1773",
"database", "db",
"username", "username",
"password", "verysecure",
"jdbc_url_params", extraParam));
}

}
2 changes: 2 additions & 0 deletions docs/integrations/destinations/mssql.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ Using this feature requires additional configuration, when creating the source.

| Version | Date | Pull Request | Subject |
|:--------| :--- |:---------------------------------------------------------|:----------------------------------------------------------------------------------------------------|
| 0.1.19 | 2022-05-25 | [13054](https://github.com/airbytehq/airbyte/pull/13054) | Destination MSSQL: added custom JDBC parameters support. |
| 0.1.18 | 2022-05-17 | [12820](https://github.com/airbytehq/airbyte/pull/12820) | Improved 'check' operation performance |
| 0.1.17 | 2022-04-05 | [11729](https://github.com/airbytehq/airbyte/pull/11729) | Bump mina-sshd from 2.7.0 to 2.8.0 |
| 0.1.15 | 2022-02-25 | [10421](https://github.com/airbytehq/airbyte/pull/10421) | Refactor JDBC parameters handling |
Expand All @@ -143,6 +144,7 @@ Using this feature requires additional configuration, when creating the source.

| Version | Date | Pull Request | Subject |
|:--------| :--- | :--- | :--- |
| 0.1.8 | 2022-05-25 | [13054](https://github.com/airbytehq/airbyte/pull/13054) | Destination MSSQL: added custom JDBC parameters support. |
| 0.1.6 | 2022-05-17 | [12820](https://github.com/airbytehq/airbyte/pull/12820) | Improved 'check' operation performance |
| 0.1.5 | 2022-02-25 | [10421](https://github.com/airbytehq/airbyte/pull/10421) | Refactor JDBC parameters handling |
| 0.1.4 | 2022-02-14 | [10256](https://github.com/airbytehq/airbyte/pull/10256) | Add `-XX:+ExitOnOutOfMemoryError` JVM option |
Expand Down