-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Destination connector for teradata vantage (rebased community PR) (#2…
…1160) * Destination connector for teradata vantage is implemented * add teradata destination to seed yaml * Add teradata destination to specs seed file Co-authored-by: Satish Chinthanippu <satishchinthanippu@gmail.com>
- Loading branch information
Showing
15 changed files
with
871 additions
and
3 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
airbyte-integrations/connectors/destination-teradata/.dockerignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
* | ||
!Dockerfile | ||
!build |
18 changes: 18 additions & 0 deletions
18
airbyte-integrations/connectors/destination-teradata/Dockerfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
FROM airbyte/integration-base-java:dev AS build | ||
|
||
WORKDIR /airbyte | ||
ENV APPLICATION destination-teradata | ||
|
||
COPY build/distributions/${APPLICATION}*.tar ${APPLICATION}.tar | ||
|
||
RUN tar xf ${APPLICATION}.tar --strip-components=1 && rm -rf ${APPLICATION}.tar | ||
|
||
FROM airbyte/integration-base-java:dev | ||
|
||
WORKDIR /airbyte | ||
ENV APPLICATION destination-teradata | ||
|
||
COPY --from=build /airbyte /airbyte | ||
|
||
LABEL io.airbyte.version=0.1.0 | ||
LABEL io.airbyte.name=airbyte/destination-teradata |
68 changes: 68 additions & 0 deletions
68
airbyte-integrations/connectors/destination-teradata/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
# Destination Teradata | ||
|
||
This is the repository for the Teradata destination connector in Java. | ||
For information about how to use this connector within Airbyte, see [the User Documentation](https://docs.airbyte.io/integrations/destinations/teradata). | ||
|
||
## Local development | ||
|
||
#### Building via Gradle | ||
From the Airbyte repository root, run: | ||
``` | ||
./gradlew :airbyte-integrations:connectors:destination-teradata:build | ||
``` | ||
|
||
#### Create credentials | ||
**If you are a community contributor**, generate the necessary credentials and place them in `secrets/config.json` conforming to the spec file in `src/main/resources/spec.json`. | ||
Note that the `secrets` directory is git-ignored by default, so there is no danger of accidentally checking in sensitive information. | ||
|
||
**If you are an Airbyte core member**, follow the [instructions](https://docs.airbyte.io/connector-development#using-credentials-in-ci) to set up the credentials. | ||
|
||
### Locally running the connector docker image | ||
|
||
#### Build | ||
Build the connector image via Gradle: | ||
``` | ||
./gradlew :airbyte-integrations:connectors:destination-teradata:airbyteDocker | ||
``` | ||
When building via Gradle, the docker image name and tag, respectively, are the values of the `io.airbyte.name` and `io.airbyte.version` `LABEL`s in | ||
the Dockerfile. | ||
|
||
#### Run | ||
Then run any of the connector commands as follows: | ||
``` | ||
docker run --rm airbyte/destination-teradata:dev spec | ||
docker run --rm -v $(pwd)/secrets:/secrets airbyte/destination-teradata:dev check --config /secrets/config.json | ||
docker run --rm -v $(pwd)/secrets:/secrets airbyte/destination-teradata:dev discover --config /secrets/config.json | ||
docker run --rm -v $(pwd)/secrets:/secrets -v $(pwd)/integration_tests:/integration_tests airbyte/destination-teradata:dev read --config /secrets/config.json --catalog /integration_tests/configured_catalog.json | ||
``` | ||
|
||
## Testing | ||
We use `JUnit` for Java tests. | ||
|
||
### Unit and Integration Tests | ||
Place unit tests under `src/test/io/airbyte/integrations/destinations/teradata`. | ||
|
||
#### Acceptance Tests | ||
Airbyte has a standard test suite that all destination connectors must pass. Implement the `TODO`s in | ||
`src/test-integration/java/io/airbyte/integrations/destinations/teradataDestinationAcceptanceTest.java`. | ||
|
||
### Using gradle to run tests | ||
All commands should be run from airbyte project root. | ||
To run unit tests: | ||
``` | ||
./gradlew :airbyte-integrations:connectors:destination-teradata:unitTest | ||
``` | ||
To run acceptance and custom integration tests: | ||
``` | ||
./gradlew :airbyte-integrations:connectors:destination-teradata:integrationTest | ||
``` | ||
|
||
## Dependency Management | ||
|
||
### Publishing a new version of the connector | ||
You've checked out the repo, implemented a million dollar feature, and you're ready to share your changes with the world. Now what? | ||
1. Make sure your changes are passing unit and integration tests. | ||
1. Bump the connector version in `Dockerfile` -- just increment the value of the `LABEL io.airbyte.version` appropriately (we use [SemVer](https://semver.org/)). | ||
1. Create a Pull Request. | ||
1. Pat yourself on the back for being an awesome contributor. | ||
1. Someone from Airbyte will take a look at your PR and iterate with you to merge it into master. |
26 changes: 26 additions & 0 deletions
26
airbyte-integrations/connectors/destination-teradata/build.gradle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
plugins { | ||
id 'application' | ||
id 'airbyte-docker' | ||
id 'airbyte-integration-test-java' | ||
} | ||
|
||
application { | ||
mainClass = 'io.airbyte.integrations.destination.teradata.TeradataDestination' | ||
applicationDefaultJvmArgs = ['-XX:+ExitOnOutOfMemoryError', '-XX:MaxRAMPercentage=75.0'] | ||
} | ||
|
||
dependencies { | ||
implementation project(':airbyte-config:config-models') | ||
implementation project(':airbyte-protocol:protocol-models') | ||
implementation project(':airbyte-integrations:bases:base-java') | ||
implementation files(project(':airbyte-integrations:bases:base-java').airbyteDocker.outputs) | ||
implementation project(':airbyte-db:db-lib') | ||
implementation project(':airbyte-integrations:bases:base-java') | ||
implementation project(':airbyte-protocol:protocol-models') | ||
implementation project(':airbyte-integrations:connectors:destination-jdbc') | ||
implementation 'com.teradata.jdbc:terajdbc4:17.20.00.12' | ||
|
||
integrationTestJavaImplementation project(':airbyte-integrations:bases:standard-destination-test') | ||
integrationTestJavaImplementation project(':airbyte-integrations:connectors:destination-teradata') | ||
} | ||
|
68 changes: 68 additions & 0 deletions
68
...adata/src/main/java/io/airbyte/integrations/destination/teradata/TeradataDestination.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/* | ||
* Copyright (c) 2022 Airbyte, Inc., all rights reserved. | ||
*/ | ||
|
||
package io.airbyte.integrations.destination.teradata; | ||
|
||
import com.fasterxml.jackson.databind.JsonNode; | ||
import com.google.common.collect.ImmutableMap; | ||
import io.airbyte.commons.json.Jsons; | ||
import io.airbyte.db.jdbc.JdbcUtils; | ||
import io.airbyte.integrations.base.Destination; | ||
import io.airbyte.integrations.base.IntegrationRunner; | ||
import io.airbyte.integrations.destination.ExtendedNameTransformer; | ||
import io.airbyte.integrations.destination.jdbc.AbstractJdbcDestination; | ||
import java.util.Collections; | ||
import java.util.Map; | ||
import java.util.Optional; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
public class TeradataDestination extends AbstractJdbcDestination implements Destination { | ||
|
||
private static final Logger LOGGER = LoggerFactory.getLogger(TeradataDestination.class); | ||
/** | ||
* Teradata JDBC driver | ||
*/ | ||
public static final String DRIVER_CLASS = "com.teradata.jdbc.TeraDriver"; | ||
/** | ||
* Default schema name | ||
*/ | ||
public static final String DEFAULT_SCHEMA_NAME = "public"; | ||
|
||
public static void main(String[] args) throws Exception { | ||
new IntegrationRunner(new TeradataDestination()).run(args); | ||
} | ||
|
||
public TeradataDestination() { | ||
super(DRIVER_CLASS, new ExtendedNameTransformer(), new TeradataSqlOperations()); | ||
} | ||
|
||
@Override | ||
protected Map<String, String> getDefaultConnectionProperties(final JsonNode config) { | ||
return Collections.emptyMap(); | ||
} | ||
|
||
@Override | ||
public JsonNode toJdbcConfig(final JsonNode config) { | ||
final String schema = Optional.ofNullable(config.get(JdbcUtils.SCHEMA_KEY)).map(JsonNode::asText).orElse(DEFAULT_SCHEMA_NAME); | ||
|
||
final String jdbcUrl = String.format("jdbc:teradata://%s/", | ||
config.get(JdbcUtils.HOST_KEY).asText()); | ||
|
||
final ImmutableMap.Builder<Object, Object> configBuilder = ImmutableMap.builder() | ||
.put(JdbcUtils.USERNAME_KEY, config.get(JdbcUtils.USERNAME_KEY).asText()) | ||
.put(JdbcUtils.JDBC_URL_KEY, jdbcUrl) | ||
.put(JdbcUtils.SCHEMA_KEY, schema); | ||
|
||
if (config.has(JdbcUtils.PASSWORD_KEY)) { | ||
configBuilder.put(JdbcUtils.PASSWORD_KEY, config.get(JdbcUtils.PASSWORD_KEY).asText()); | ||
} | ||
|
||
if (config.has(JdbcUtils.JDBC_URL_PARAMS_KEY)) { | ||
configBuilder.put(JdbcUtils.JDBC_URL_PARAMS_KEY, config.get(JdbcUtils.JDBC_URL_PARAMS_KEY).asText()); | ||
} | ||
return Jsons.jsonNode(configBuilder.build()); | ||
} | ||
|
||
} |
Oops, something went wrong.