Use BigQuery TRANSLATE Instead of Teradata OTRANSLATE
You can specify that Hyper-Q use the native TRANSLATE function for BigQuery instead of the Hyper-Q emulation of the Teradata OTRANSLATE function.
You can configure your Hyper-Q environment to use the native TRANSLATE function when you have users who access BigQuery outside of Hyper-Q . Typically, Hyper-Q is granted more access than many users have, which prevents those users from running queries using Teradata OTRANSLATE outside of Hyper-Q.
There are behavioral differences between Teradata OTRANSLATE and BigQuery TRANSLATE. When using Teradata OTRANSLATE, if the same character occurs more than once in the from_string, only the replacement character from the to_string corresponding to the first occurrence is used. When using BigQuery TRANSLATE, a duplicate character in source_characters results in an error. You should carefully review the documentation for Teradata OTRANSLATE and BigQuery TRANSLATE to determine which is the preferred solution for your environment.
The syntax for use_native_translate_for_otranslate
is:
use_native_translate_for_otranslate = true | false
where:
Parameter | Description |
---|---|
| Specifies that Hyper-Q use the native TRANSLATE function for BigQuery instead of the Hyper-Q emulation of the Teradata OTRANSLATE function. |
| Specifies the Hyper-Q emulate the Teradata OTRANSLATE function. This is the default behavior. |
Hint Scope
The use_native_translate_for_otranslate
hint can be specified at the session, request, query, and global level. To learn more about Hyper-Q SQL hints, and how to use them within a SQL query, see About Hyper-Q SQL Hints.
You can specify use_native_translate_for_otranslate
as a global setting in the Hyper-Q configuration file (dtm.ini
). To enable use_native_translate_for_otranslate
, set it to true
. The default value is false
.
"gateway".use_native_translate_for_otranslate=true
To learn more about specifying a hint as a gateway
option in the Hyper-Q configuration file, see Gateway Configuration Parameters.
You can specify use_native_translate_for_otranslate
as a query hint at either the session, request, or query level. This examples specifies that Hyper-Q use the native BigQuery translate function for the request.
SELECT -- @dtm_use_native_translate_for_otranslate=true for request OTRANSLATE('abcde', 'ace', '1234');
To learn more about Hyper-Q SQL hints, and how to use them within a SQL query, see About Hyper-Q SQL Hints.
If you configure Hyper-Q to use the native TRANSLATE function for BigQuery at the global (or application) level, you can override this for individual sessions, requests, or queries by setting use_native_translate_for_otranslate
to false
within a query.
"gateway".use_native_translate_for_otranslate=true ... SELECT @ dtm_use_native_translate_for_otranslate=false for request OTRANSLATE('abcde', 'ace', '1234');