-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Add Teradata connector #26731
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
Open
sc250072
wants to merge
1
commit into
trinodb:master
Choose a base branch
from
Teradata:teradata-connector
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Add Teradata connector #26731
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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,201 @@ | ||
| # Teradata connector | ||
|
|
||
| ```{raw} html | ||
| <img src="../_static/img/teradata.png" class="connector-logo"> | ||
|
sc250072 marked this conversation as resolved.
|
||
| ``` | ||
|
|
||
| The Teradata connector allows querying and creating tables in an | ||
| external [Teradata](https://www.teradata.com/) database. This can be used to join data between | ||
| different systems like Teradata and Hive, or between different | ||
| Teradata instances. | ||
|
|
||
| ## Requirements | ||
|
|
||
| To connect to Teradata, you need: | ||
|
|
||
| - Teradata database 16.20 or higher. | ||
| - Network access from the Trino coordinator and workers to Teradata. | ||
| - Port 1025 is the default port. | ||
|
|
||
| ## Configuration | ||
|
|
||
| The connector can query a database on a given Teradata instance. Create a catalog | ||
| properties file that specifies the Teradata connector by setting the | ||
| `connector.name` to `teradata`. | ||
|
|
||
| For example, to access a database as the `example` catalog, create the file | ||
| `etc/catalog/example.properties`. Replace the connection properties as | ||
| appropriate for your setup: | ||
|
|
||
| ```properties | ||
| connector.name=teradata | ||
| connection-url=jdbc:teradata://example.teradata.com/CHARSET=UTF8,TMODE=ANSI,LOGMECH=TD2 | ||
| connection-user=root | ||
| connection-password=secret | ||
| ``` | ||
|
|
||
| The `connection-url` defines the connection information and parameters to pass | ||
| to the Teradata JDBC driver. The parameters for the URL are available in the | ||
| [Teradata JDBC documentation](https://teradata-docs.s3.amazonaws.com/doc/connectivity/jdbc/reference/current/jdbcug_chapter_2.html#BABJIHBJ). | ||
|
|
||
| The `connection-user` and `connection-password` are typically required and | ||
| determine the user credentials for the connection, often a service user. You can | ||
| use {doc}`secrets </security/secrets>` to avoid actual values in the catalog | ||
| properties files. | ||
|
|
||
| ### Connection security | ||
|
|
||
| If you have TLS configured with a globally-trusted certificate installed on | ||
| your data source, you can enable TLS between your cluster and the data | ||
| source by appending parameters to the JDBC connection string set in the | ||
| connection-url catalog configuration property. | ||
|
|
||
| For example, to specify `SSLMODE`: | ||
|
|
||
| ```properties | ||
| connection-url=jdbc:teradata://example.teradata.com/SSLMODE=REQUIRED | ||
| ``` | ||
|
|
||
| For more information on TLS configuration options, see the | ||
| Teradata [JDBC documentation](https://teradata-docs.s3.amazonaws.com/doc/connectivity/jdbc/reference/current/jdbcug_chapter_2.html#URL_SSLMODE). | ||
|
|
||
| ```{include} jdbc-authentication.fragment | ||
| ``` | ||
|
|
||
| ### Multiple Teradata databases | ||
|
|
||
| The Teradata connector can only access a single Teradata database within | ||
| a single catalog. Thus, if you have multiple Teradata databases, | ||
| or want to connect to multiple Teradata instances, you must configure | ||
| multiple instances of the Teradata connector. | ||
|
|
||
| To add another catalog, simply add another properties file to `etc/catalog` | ||
| with a different name, making sure it ends in `.properties`. For example, | ||
| if you name the property file `sales.properties`, Trino creates a | ||
| catalog named `sales` using the configured connector. | ||
|
|
||
| ### Specific configuration properties | ||
|
|
||
| The Teradata connector supports additional catalog properties to configure the | ||
| behavior of the connector and the queries issued to the database. | ||
|
|
||
| :::{list-table} | ||
| :widths: 45, 55 | ||
| :header-rows: 1 | ||
|
|
||
| * - Property name | ||
| - Description | ||
| * - `teradata.permanent-space` | ||
| - Permanent space allocation in bytes for new databases created via | ||
| `CREATE SCHEMA`. Defaults to `60000000` (60 MB). You can configure this | ||
| property to specify a different permanent space allocation, or create the | ||
| database manually in Teradata before using it in Trino. Refer to the | ||
| [Teradata PERMANENT clause documentation](https://docs.teradata.com/r/Enterprise_IntelliFlex_VMware/SQL-Data-Definition-Language-Syntax-and-Examples/Database-Statements/CREATE-DATABASE/CREATE-DATABASE-Syntax-Elements/PERMANENT) | ||
| for more information. | ||
| ::: | ||
|
|
||
| ## Type mapping | ||
|
|
||
| Because Trino and Teradata each support types that the other does not, this | ||
| connector {ref}`modifies some types <type-mapping-overview>` when reading data. | ||
| Refer to the following sections for type mapping when reading data from | ||
| Teradata to Trino. | ||
|
|
||
| ### Teradata type to Trino type mapping | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you add "Trino type to Teradata type mapping" as well?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. added |
||
|
|
||
| The connector maps Teradata types to the corresponding Trino types following | ||
| this table: | ||
|
|
||
| :::{list-table} Teradata type to Trino type mapping | ||
| :widths: 40, 40, 20 | ||
| :header-rows: 1 | ||
|
|
||
| * - Teradata type | ||
| - Trino type | ||
| - Notes | ||
|
sc250072 marked this conversation as resolved.
|
||
| * - `TINYINT` | ||
| - `TINYINT` | ||
| - | ||
| * - `SMALLINT` | ||
| - `SMALLINT` | ||
| - | ||
| * - `INTEGER` | ||
| - `INTEGER` | ||
| - | ||
| * - `BIGINT` | ||
| - `BIGINT` | ||
| - | ||
| * - `REAL` | ||
| - `DOUBLE` | ||
| - | ||
| * - `DOUBLE` | ||
| - `DOUBLE` | ||
| - | ||
| * - `FLOAT` | ||
| - `DOUBLE` | ||
| - | ||
| * - `NUMBER(p, s)` | ||
| - `DECIMAL(p, s)` | ||
| - | ||
| * - `NUMERIC(p, s)` | ||
| - `DECIMAL(p, s)` | ||
| - | ||
| * - `DECIMAL(p, s)` | ||
| - `DECIMAL(p, s)` | ||
| - | ||
| * - `CHAR(n)`, `CHARACTER(n)` | ||
| - `CHAR(n)` | ||
| - `CHAR` is an alias of `CHARACTER`. See [Teradata CHARACTER documentation](https://docs.teradata.com/r/Enterprise_IntelliFlex_VMware/SQL-Data-Types-and-Literals/Character-and-CLOB-Data-Types/CHARACTER-Data-Type) | ||
| * - `VARCHAR(n)` | ||
| - `VARCHAR(n)` | ||
| - | ||
| * - `DATE` | ||
| - `DATE` | ||
| - | ||
| ::: | ||
|
|
||
| No other types are supported. | ||
|
|
||
| ### Trino type to Teradata type mapping | ||
|
|
||
| The connector maps Trino types to the corresponding Teradata types following | ||
| this table: | ||
|
|
||
| :::{list-table} Trino type to Teradata type mapping | ||
| :widths: 50, 50 | ||
| :header-rows: 1 | ||
|
|
||
| * - Trino type | ||
| - Teradata type | ||
| * - `TINYINT` | ||
| - `SMALLINT` | ||
| * - `SMALLINT` | ||
| - `SMALLINT` | ||
| * - `INTEGER` | ||
| - `INTEGER` | ||
| * - `BIGINT` | ||
| - `BIGINT` | ||
| * - `REAL` | ||
| - `FLOAT` | ||
| * - `DOUBLE` | ||
| - `DOUBLE` | ||
| * - `DATE` | ||
| - `DATE` | ||
| ::: | ||
|
|
||
| No other types are supported. | ||
|
|
||
| ```{include} jdbc-type-mapping.fragment | ||
| ``` | ||
|
|
||
| ## SQL support | ||
|
|
||
| The connector provides read and limited write access to data and metadata in | ||
| a Teradata database. In addition to the [globally available](sql-globally-available) and | ||
| [read operation](sql-read-operations) statements, the connector supports the | ||
| following features: | ||
|
|
||
| - [](/sql/create-schema) | ||
| - [](/sql/drop-schema) | ||
| - [](/sql/create-table) | ||
| - [](/sql/drop-table) | ||
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 hidden or 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,42 @@ | ||
| # Teradata Connector Developer Notes | ||
|
|
||
| The Teradata connector module has both unit tests and integration tests. | ||
| The integration tests require access to a [Teradata ClearScape Analytics™ Experience](https://clearscape.teradata.com/sign-in). | ||
| You can follow the steps below to run the integration tests locally. | ||
|
|
||
| ## Prerequisites | ||
|
|
||
| #### 1. Create a new ClearScape Analytics™ Experience account | ||
|
|
||
| If you don't already have one, sign up at: | ||
|
|
||
| [Teradata ClearScape Analytics™ Experience](https://www.teradata.com/getting-started/demos/clearscape-analytics) | ||
|
|
||
| #### 2. Login | ||
|
|
||
| Sign in with your new account at: | ||
|
|
||
| [ClearScape Analytics™ Experience Login](https://clearscape.teradata.com/sign-in) | ||
|
|
||
| #### 3. Collect the API Token | ||
|
|
||
| Use the **Copy API Token** button in the UI to retrieve your token. | ||
|
|
||
| #### 4. Define the following environment variables | ||
|
|
||
| ⚠️ **Note:** The Teradata database password must be **at least 8 characters long**. | ||
|
|
||
| ``` | ||
| export CLEARSCAPE_TOKEN=<API Token> | ||
| export CLEARSCAPE_PASSWORD=<Password for Teradata database (min 8 chars)> | ||
| ``` | ||
|
|
||
| ## Running Integration Tests | ||
|
|
||
| Once the environment variables are set, run the integration tests with: | ||
|
|
||
| ⚠️ **Note:** Run the following command from the Trino parent directory. | ||
|
|
||
| ``` | ||
| ./mvnw clean install -pl :trino-teradata | ||
| ``` |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.