Skip to content

Commit c039b23

Browse files
authored
Merge pull request #211 from Teradata/IDE-24842_MT255026
Support http proxy parameters in dbt-adapter
2 parents f3ab475 + 26fc6a6 commit c039b23

File tree

2 files changed

+50
-1
lines changed

2 files changed

+50
-1
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,13 +229,20 @@ Parameter | Default | Type | Description
229229
`field_sep` | `","` | string | Specifies a single character string used to separate fields in a CSV file. Equivalent to the Teradata JDBC Driver `FIELD_SEP` connection parameter.
230230
`host` | | string | Specifies the database hostname.
231231
`https_port` | `"443"` | quoted integer | Specifies the database port number for HTTPS/TLS connections. Equivalent to the Teradata JDBC Driver `HTTPS_PORT` connection parameter.
232+
`http_proxy` | | string | Specifies the proxy server URL for HTTP connections to TLS certificate verification CRL and OCSP endpoints. The URL must begin with http:// and must include a colon : and port number.
233+
`http_proxy_user` | | string | Specifies the proxy server username for the proxy server identified by the http_proxy parameter. This parameter may only be specified in conjunction with the http_proxy parameter. When this parameter is omitted, no proxy server username is provided to the proxy server identified by the http_proxy parameter.
234+
`http_proxy_password` | | string | Specifies the proxy server password for the proxy server identified by the http_proxy parameter. This parameter may only be specified in conjunction with the http_proxy parameter. When this parameter is omitted, no proxy server password is provided to the proxy server identified by the http_proxy parameter.
235+
`https_proxy` | | string | Specifies the proxy server URL for HTTPS/TLS connections to the database and to Identity Provider endpoints. The URL must begin with http:// and must include a colon : and port number. The driver connects to the proxy server using a non-TLS HTTP connection, then uses the HTTP CONNECT method to establish an HTTPS/TLS connection to the destination. Equivalent to the Teradata JDBC Driver HTTPS_PROXY connection parameter.
236+
`https_proxy_user` | | string | Specifies the proxy server username for the proxy server identified by the https_proxy parameter. This parameter may only be specified in conjunction with the https_proxy parameter. When this parameter is omitted, no proxy server username is provided to the proxy server identified by the https_proxy parameter. Equivalent to the Teradata JDBC Driver HTTPS_PROXY_USER connection parameter.
237+
`https_proxy_password` | | string | Specifies the proxy server password for the proxy server identified by the https_proxy parameter. This parameter may only be specified in conjunction with the https_proxy parameter. When this parameter is omitted, no proxy server password is provided to the proxy server identified by the https_proxy parameter. Equivalent to the Teradata JDBC Driver HTTPS_PROXY_PASSWORD connection parameter.
232238
`lob_support` | `"true"` | quoted boolean | Controls LOB support. Equivalent to the Teradata JDBC Driver `LOB_SUPPORT` connection parameter.
233239
`log` | `"0"` | quoted integer | Controls debug logging. Somewhat equivalent to the Teradata JDBC Driver `LOG` connection parameter. This parameter's behavior is subject to change in the future. This parameter's value is currently defined as an integer in which the 1-bit governs function and method tracing, the 2-bit governs debug logging, the 4-bit governs transmit and receive message hex dumps, and the 8-bit governs timing. Compose the value by adding together 1, 2, 4, and/or 8.
234240
`logdata` | | string | Specifies extra data for the chosen logon authentication method. Equivalent to the Teradata JDBC Driver `LOGDATA` connection parameter.
235241
`logon_timeout` | `"0"` | quoted integer | Specifies the logon timeout in seconds. Zero means no timeout.
236242
`logmech` | `"TD2"` | string | Specifies the logon authentication method. Equivalent to the Teradata JDBC Driver `LOGMECH` connection parameter. Possible values are `TD2` (the default), `JWT`, `LDAP`, `BROWSER`, `KRB5` for Kerberos, or `TDNEGO`.
237243
`max_message_body` | `"2097000"` | quoted integer | Specifies the maximum Response Message size in bytes. Equivalent to the Teradata JDBC Driver `MAX_MESSAGE_BODY` connection parameter.
238244
`partition` | `"DBC/SQL"` | string | Specifies the database partition. Equivalent to the Teradata JDBC Driver `PARTITION` connection parameter.
245+
`proxy_bypass_hosts` | | string | Specifies a matching pattern for hostnames and addresses to bypass the proxy server identified by the http_proxy and/or https_proxy parameter. This parameter may only be specified in conjunction with the http_proxy and/or https_proxy parameter. Separate multiple hostnames and addresses with a vertical bar | character. Specify an asterisk * as a wildcard character. When this parameter is omitted, the default pattern localhost|127.*|[::1] bypasses the proxy server identified by the http_proxy and/or https_proxy parameter for common variations of the loopback address. Equivalent to the Teradata JDBC Driver PROXY_BYPASS_HOSTS connection parameter.
239246
`request_timeout` | `"0"` | quoted integer | Specifies the timeout for executing each SQL request. Zero means no timeout.
240247
`retries` | `0` | integer | Allows an adapter to automatically try again when the attempt to open a new connection on the database has a transient, infrequent error. This option can be set using the retries configuration. Default value is 0. The default wait period between connection attempts is one second. retry_timeout (seconds) option allows us to adjust this waiting period.
241248
`runstartup` | "false" | quoted boolean | Controls whether the user's STARTUP SQL request is executed after logon. For more information, refer to User STARTUP SQL Request. Equivalent to the Teradata JDBC Driver RUNSTARTUP connection parameter. If retries is set to 3, the adapter will try to establish a new connection three times if an error occurs.
@@ -244,9 +251,11 @@ Parameter | Default | Type | Description
244251
`sp_spl` | `"true"` | quoted boolean | Controls whether stored procedure source code is saved in the database when a SQL stored procedure is created. Equivalent to the Teradata JDBC Driver SP_SPL connection parameter.
245252
`sslca` | | string | Specifies the file name of a PEM file that contains Certificate Authority (CA) certificates for use with `sslmode` values `VERIFY-CA` or `VERIFY-FULL`. Equivalent to the Teradata JDBC Driver `SSLCA` connection parameter.
246253
`sslcrc` | `"ALLOW"` | string | Equivalent to the Teradata JDBC Driver SSLCRC connection parameter. Values are case-insensitive.<br/>&bull; ALLOW provides "soft fail" behavior such that communication failures are ignored during certificate revocation checking. <br/>&bull; REQUIRE mandates that certificate revocation checking must succeed.
254+
`sslcrl` | `"true"` | quoted boolean | Controls the use of Certificate Revocation List (CRL) for TLS certificate revocation checking for HTTPS/TLS connections. Online Certificate Status Protocol (OCSP) is preferred over CRL, so CRL is used when OSCP is unavailable. Equivalent to the Teradata JDBC Driver SSLCRL connection parameter.
247255
`sslcapath` | | string | Specifies a directory of PEM files that contain Certificate Authority (CA) certificates for use with `sslmode` values `VERIFY-CA` or `VERIFY-FULL`. Only files with an extension of `.pem` are used. Other files in the specified directory are not used. Equivalent to the Teradata JDBC Driver `SSLCAPATH` connection parameter.
248256
`sslcipher` | | string | Specifies the TLS cipher for HTTPS/TLS connections. Equivalent to the Teradata JDBC Driver `SSLCIPHER` connection parameter.
249257
`sslmode` | `"PREFER"` | string | Specifies the mode for connections to the database. Equivalent to the Teradata JDBC Driver `SSLMODE` connection parameter.<br/>&bull; `DISABLE` disables HTTPS/TLS connections and uses only non-TLS connections.<br/>&bull; `ALLOW` uses non-TLS connections unless the database requires HTTPS/TLS connections.<br/>&bull; `PREFER` uses HTTPS/TLS connections unless the database does not offer HTTPS/TLS connections.<br/>&bull; `REQUIRE` uses only HTTPS/TLS connections.<br/>&bull; `VERIFY-CA` uses only HTTPS/TLS connections and verifies that the server certificate is valid and trusted.<br/>&bull; `VERIFY-FULL` uses only HTTPS/TLS connections, verifies that the server certificate is valid and trusted, and verifies that the server certificate matches the database hostname.
258+
`sslocsp` | `"true"` | quoted boolean | Controls the use of Online Certificate Status Protocol (OCSP) for TLS certificate revocation checking for HTTPS/TLS connections. Equivalent to the Teradata JDBC Driver SSLOCSP connection parameter.
250259
`sslprotocol` | `"TLSv1.2"` | string | Specifies the TLS protocol for HTTPS/TLS connections. Equivalent to the Teradata JDBC Driver `SSLPROTOCOL` connection parameter.
251260
`teradata_values` | `"true"` | quoted boolean | Controls whether `str` or a more specific Python data type is used for certain result set column value types.
252261
`query_band` | `"org=teradata-internal-telem;appname=dbt;"` | string | Specifies the Query Band string to be set for each SQL request.

dbt/adapters/teradata/connections.py

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,16 @@ class TeradataCredentials(Credentials):
6161
https_port: Optional[int] = None
6262
connect_timeout: Optional[int] = None
6363
request_timeout: Optional[int] = None
64+
http_proxy: Optional[str] = None
65+
http_proxy_user: Optional[str] = None
66+
http_proxy_password: Optional[str] = None
67+
https_proxy: Optional[str] = None
68+
https_proxy_user: Optional[str] = None
69+
https_proxy_password: Optional[str] = None
70+
sslcrl: Optional[bool] = None
71+
sslocsp: Optional[bool] = None
72+
proxy_bypass_hosts: Optional[str] = None
73+
oidc_sslmode: Optional[str] = None
6474

6575
_ALIASES = {
6676
"UID": "username",
@@ -155,7 +165,17 @@ def _connection_keys(self):
155165
"https_port",
156166
"connect_timeout",
157167
"request_timeout",
158-
"query_band"
168+
"query_band",
169+
"http_proxy",
170+
"http_proxy_user",
171+
"http_proxy_password",
172+
"https_proxy",
173+
"https_proxy_user",
174+
"https_proxy_password",
175+
"sslcrl",
176+
"sslocsp",
177+
"proxy_bypass_hosts",
178+
"oidc_sslmode"
159179
)
160180

161181
@classmethod
@@ -270,6 +290,26 @@ def open(cls, connection):
270290
kwargs["connect_timeout"]=credentials.connect_timeout
271291
if credentials.request_timeout:
272292
kwargs["request_timeout"]=credentials.request_timeout
293+
if credentials.http_proxy:
294+
kwargs["http_proxy"]=credentials.http_proxy
295+
if credentials.http_proxy_user:
296+
kwargs["http_proxy_user"]=credentials.http_proxy_user
297+
if credentials.http_proxy_password:
298+
kwargs["http_proxy_password"]=credentials.http_proxy_password
299+
if credentials.https_proxy:
300+
kwargs["https_proxy"]=credentials.https_proxy
301+
if credentials.https_proxy_user:
302+
kwargs["https_proxy_user"]=credentials.https_proxy_user
303+
if credentials.https_proxy_password:
304+
kwargs["https_proxy_password"]=credentials.https_proxy_password
305+
if credentials.sslcrl:
306+
kwargs["sslcrl"]=credentials.sslcrl
307+
if credentials.sslocsp:
308+
kwargs["sslocsp"]=credentials.sslocsp
309+
if credentials.proxy_bypass_hosts:
310+
kwargs["proxy_bypass_hosts"]=credentials.proxy_bypass_hosts
311+
if credentials.oidc_sslmode:
312+
kwargs["oidc_sslmode"]=credentials.oidc_sslmode
273313

274314
# Save the transaction mode
275315
cls.TMODE = credentials.tmode

0 commit comments

Comments
 (0)