Package: teradatasql
Teradata SQL Driver for PythonThis package enables Python applications to connect to the Teradata Database.This package implements thePEP-249 Python Database API Specification 2.0.This package requires 64-bit Python 3.7 or later, and runs on Windows, macOS, and Linux. 32-bit Python is not supported.For community support, please visitTeradata Community.For Teradata customer support, please visitTeradata Customer Service.Please note, this driver may contain beta/preview features ("Beta Features"). As such, by downloading and/or using the driver, in addition to agreeing to the licensing terms below, you acknowledge that the Beta Features are experimental in nature and that the Beta Features are provided "AS IS" and may not be functional on any machine or in any environment.Copyright 2024 Teradata. All Rights Reserved.Table of ContentsFeaturesLimitationsInstallationLicenseDocumentationSample ProgramsUsing the DriverConnection ParametersCOP DiscoveryStored Password ProtectionClient AttributesUser STARTUP SQL RequestTransaction ModeAuto-CommitData TypesNull ValuesCharacter Export WidthModule ConstructorsModule GlobalsModule ExceptionsConnection AttributesConnection MethodsCursor AttributesCursor MethodsType ObjectsEscape SyntaxFastLoadFastExportCSV Batch InsertsCSV Export ResultsChange LogFeaturesTheTeradata SQL Driver for Pythonis a DBAPI Driver that enables Python applications to connect to the Teradata Database. The driver implements thePEP-249 Python Database API Specification 2.0.The driver is a young product that offers a basic feature set. We are working diligently to add features to the driver, and our goal is feature parity with the Teradata JDBC Driver.At the present time, the driver offers the following features.Supported for use with Teradata database 16.20 and later releases.COP Discovery.Laddered Concurrent Connect.HTTPS/TLS connections with Teradata database 16.20.53.30 and later.Encrypted logon using theTD2,JWT,LDAP,KRB5(Kerberos), orTDNEGOlogon mechanisms.Data encryption governed by central administration, or enabled via theencryptdataconnection parameter.Unicode character data transferred via the UTF8 session character set.Auto-commit for ANSI and TERA transaction modes.Result set row size up to 1 MB.Multi-statement requests that return multiple result sets.Most JDBC escape syntax.Parameterized SQL requests with question-mark parameter markers.Parameterized batch SQL requests with multiple rows of data bound to question-mark parameter markers.Auto-Generated Key Retrieval (AGKR) for identity column values and more.Large Object (LOB) support for the BLOB and CLOB data types.Complex data types such asXML,JSON,DATASET STORAGE FORMAT AVRO, andDATASET STORAGE FORMAT CSV.ElicitFile protocol support for DDL commands that create external UDFs or stored procedures and upload a file from client to database.CREATE PROCEDUREandREPLACE PROCEDUREcommands.Stored Procedure Dynamic Result Sets.FastLoad and FastExport.LimitationsThe UTF8 session character set is always used. Thecharsetconnection parameter is not supported.No support yet for Recoverable Network Protocol and Redrive.Monitor partition support is not available yet.InstallationTheteradatasqlpackage depends on thepycryptodomepackage which is available from PyPI.Usepip installto download and install the driver and its dependencies automatically.PlatformCommandmacOS or Linuxpip install teradatasqlWindowspy -3 -m pip install teradatasqlWhen upgrading to a new version of the driver, you may need to use pip install's--no-cache-diroption to force the download of the new version.PlatformCommandmacOS or Linuxpip install --no-cache-dir -U teradatasqlWindowspy -3 -m pip install --no-cache-dir -U teradatasqlTheteradatasqlpackage depends on thepycryptodomepackage, because one of the included sample programs (TJEncryptPassword.py) usespycryptodome. The driver itself does not usepycryptodome.If you want to avoid installingpycryptodome, you can use the--no-depsoption of pip install to avoid installingpycryptodome. Withoutpycryptodome, you will not be able to run theTJEncryptPassword.pysample program.PlatformCommandmacOS or Linuxpip install --no-deps teradatasqlWindowspy -3 -m pip install --no-deps teradatasqlLicenseUse of the driver is governed by theLicense Agreement for the Teradata SQL Driver for Python.When the driver is installed, theLICENSEandTHIRDPARTYLICENSEfiles are placed in theteradatasqldirectory under your Python installation directory.In addition to the license terms, the driver may contain beta/preview features ("Beta Features"). As such, by downloading and/or using the driver, in addition to the licensing terms, you acknowledge that the Beta Features are experimental in nature and that the Beta Features are provided "AS IS" and may not be functional on any machine or in any environment.DocumentationWhen the driver is installed, theREADME.mdfile is placed in theteradatasqldirectory under your Python installation directory. This permits you to view the documentation offline, when you are not connected to the Internet.TheREADME.mdfile is a plain text file containing the documentation for the driver. While the file can be viewed with any text file viewer or editor, your viewing experience will be best with an editor that understands Markdown format.Sample ProgramsSample programs are provided to demonstrate how to use the driver. When the driver is installed, the sample programs are placed in theteradatasql/samplesdirectory under your Python installation directory.The sample programs are coded with a fake database hostnamewhomooz, usernameguest, and passwordplease. Substitute your actual database hostname and credentials before running a sample program.ProgramPurposeAGKRBatchInsert.pyDemonstrates how to insert a batch of rows with Auto-Generated Key Retrieval (AGKR)AGKRInsertSelect.pyDemonstrates Insert/Select with Auto-Generated Key Retrieval (AGKR)BatchInsert.pyDemonstrates how to insert a batch of rowsBatchInsertCSV.pyDemonstrates how to insert a batch of rows from a CSV fileBatchInsPerf.pyMeasures time to insert one million rowsCancelSleep.pyDemonstrates how to use the cancel method to interrupt a queryCharPadding.pyDemonstrates the database'sCharacter Export WidthbehaviorCommitRollback.pyDemonstrates commit and rollback methods with auto-commit off.DecimalDigits.pyDemonstrates how to format decimal.Decimal values.DriverDatabaseVersion.pyDisplays the driver version and database versionElicitFile.pyDemonstrates C source file upload to create a User-Defined Function (UDF)ExportCSVResult.pyDemonstrates how to export a query result set to a CSV fileExportCSVResults.pyDemonstrates how to export multiple query result sets to CSV filesFakeExportCSVResults.pyDemonstrates how to export multiple query result sets with the metadata to CSV filesFakeResultSetCon.pyDemonstrates connection parameter for fake result setsFakeResultSetEsc.pyDemonstrates escape function for fake result setsFastExportCSV.pyDemonstrates how to FastExport rows from a table to a CSV fileFastExportTable.pyDemonstrates how to FastExport rows from a tableFastLoadBatch.pyDemonstrates how to FastLoad batches of rowsFastLoadCSV.pyDemonstrates how to FastLoad batches of rows from a CSV fileHelpSession.pyDisplays session informationIgnoreErrors.pyDemonstrates how to ignore errorsInsertLob.pyDemonstrates how to insert BLOB and CLOB valuesInsertXML.pyDemonstrates how to insert and retrieve XML valuesLoadCSVFile.pyDemonstrates how to load data from a CSV file into a tableLobLocators.pyDemonstrates how to use LOB locatorsMetadataFromPrepare.pyDemonstrates how to prepare a SQL request and obtain SQL statement metadataMultiThread.pyDemonstrates how to use multiple threads to load data in parallelParamDataTypes.pyDemonstrates how to specify data types for parameter marker bind valuesShowCommand.pyDisplays the results from theSHOWcommandStoredProc.pyDemonstrates how to create and call a SQL stored procedureTJEncryptPassword.pyCreates encrypted password filesUsing the DriverYour Python script must import theteradatasqlpackage in order to use the driver.import teradatasqlAfter importing theteradatasqlpackage, your Python script calls theteradatasql.connectfunction to open a connection to the database.You may specify connection parameters as a JSON string, askwargs, or using a combination of the two approaches. Theteradatasql.connectfunction's first argument is an optional JSON string. Theteradatasql.connectfunction's second and subsequent arguments are optionalkwargs.Connection parameters specified only askwargs:con = teradatasql.connect(host="whomooz", user="guest", password="please")Connection parameters specified only as a JSON string:con = teradatasql.connect('{"host":"whomooz","user":"guest","password":"please"}')Connection parameters specified using a combination:con = teradatasql.connect('{"host":"whomooz"}', user="guest", password="please")When a combination of parameters are specified, connection parameters specified askwargstake precedence over same-named connection parameters specified in the JSON string.Connection ParametersThe following table lists the connection parameters currently offered by the driver. Connection parameter values are case-sensitive unless stated otherwise.Our goal is consistency for the connection parameters offered by this driver and the Teradata JDBC Driver, with respect to connection parameter names and functionality. For comparison, Teradata JDBC Driver connection parameters aredocumented here.ParameterDefaultTypeDescriptionaccountstringSpecifies the database account. Equivalent to the Teradata JDBC DriverACCOUNTconnection parameter.browserstringSpecifies the command to open the browser for Browser Authentication, whenlogmechisBROWSER. Browser Authentication is supported for Windows and macOS. Equivalent to the Teradata JDBC DriverBROWSERconnection parameter.The specified command must include a placeholder token, literally specified asPLACEHOLDER, which the driver will replace with the Identity Provider authorization endpoint URL. ThePLACEHOLDERtoken is case-sensitive and must be specified in uppercase.• On Windows, the default command iscmd /c start "title" "PLACEHOLDER". Windows command syntax requires the quoted title to precede the quoted URL.• On macOS, the default command isopen PLACEHOLDER. macOS command syntax does not allow the URL to be quoted.browser_tab_timeout"5"quoted integerSpecifies the number of seconds to wait before closing the browser tab after Browser Authentication is completed. The default is 5 seconds. The behavior is under the browser's control, and not all browsers support automatic closing of browser tabs. Typically, the tab used to log on will remain open indefinitely, but the second and subsequent tabs will be automatically closed. Specify0(zero) to close the tab immediately. Specify-1to turn off automatic closing of browser tabs. Browser Authentication is supported for Windows and macOS. Equivalent to the Teradata JDBC DriverBROWSER_TAB_TIMEOUTconnection parameter.browser_timeout"180"quoted integerSpecifies the number of seconds that the driver will wait for Browser Authentication to complete. The default is 180 seconds (3 minutes). Browser Authentication is supported for Windows and macOS. Equivalent to the Teradata JDBC DriverBROWSER_TIMEOUTconnection parameter.column_name"false"quoted booleanControls the behavior of cursor.descriptionsequencenameitems. Equivalent to the Teradata JDBC DriverCOLUMN_NAMEconnection parameter. False specifies that a cursor.descriptionsequencenameitem provides the AS-clause name if available, or the column name if available, or the column title. True specifies that a cursor.descriptionsequencenameitem provides the column name if available, but has no effect when StatementInfo parcel support is unavailable.connect_failure_ttl"0"quoted integerSpecifies the time-to-live in seconds to remember the most recent connection failure for each IP address/port combination. The driver subsequently skips connection attempts to that IP address/port for the duration of the time-to-live. The default value of zero disables this feature. The recommended value is half the database restart time. Equivalent to the Teradata JDBC DriverCONNECT_FAILURE_TTLconnection parameter.connect_function"0"quoted integerSpecifies whether the database should allocate a Logon Sequence Number (LSN) for this session, or associate this session with an existing LSN. Specify0for a session with no LSN (the default). Specify1to allocate a new LSN for the session. Specify2to associate the session with the existing LSN identified by thelogon_sequence_numberconnection parameter. The database only permits sessions for the same user to share an LSN. Equivalent to the Teradata JDBC DriverCONNECT_FUNCTIONconnection parameter.connect_timeout"10000"quoted integerSpecifies the timeout in milliseconds for establishing a TCP socket connection. Specify0for no timeout. The default is 10 seconds (10000 milliseconds).cop"true"quoted booleanSpecifies whether COP Discovery is performed. Equivalent to the Teradata JDBC DriverCOPconnection parameter.coplast"false"quoted booleanSpecifies how COP Discovery determines the last COP hostname. Equivalent to the Teradata JDBC DriverCOPLASTconnection parameter. Whencoplastisfalseor omitted, or COP Discovery is turned off, then no DNS lookup occurs for the coplast hostname. Whencoplastistrue, and COP Discovery is turned on, then a DNS lookup occurs for a coplast hostname.databasestringSpecifies the initial database to use after logon, instead of the user's default database. Equivalent to the Teradata JDBC DriverDATABASEconnection parameter.dbs_port"1025"quoted integerSpecifies the database port number. Equivalent to the Teradata JDBC DriverDBS_PORTconnection parameter.encryptdata"false"quoted booleanControls encryption of data exchanged between the driver and the database. Equivalent to the Teradata JDBC DriverENCRYPTDATAconnection parameter.error_query_count"21"quoted integerSpecifies how many times the driver will attempt to query FastLoad Error Table 1 after a FastLoad operation. Equivalent to the Teradata JDBC DriverERROR_QUERY_COUNTconnection parameter.error_query_interval"500"quoted integerSpecifies how many milliseconds the driver will wait between attempts to query FastLoad Error Table 1. Equivalent to the Teradata JDBC DriverERROR_QUERY_INTERVALconnection parameter.error_table_1_suffix"_ERR_1"stringSpecifies the suffix for the name of FastLoad Error Table 1. Equivalent to the Teradata JDBC DriverERROR_TABLE_1_SUFFIXconnection parameter.error_table_2_suffix"_ERR_2"stringSpecifies the suffix for the name of FastLoad Error Table 2. Equivalent to the Teradata JDBC DriverERROR_TABLE_2_SUFFIXconnection parameter.error_table_databasestringSpecifies the database name for the FastLoad error tables. By default, FastLoad error tables reside in the same database as the destination table being loaded. Equivalent to the Teradata JDBC DriverERROR_TABLE_DATABASEconnection parameter.fake_result_sets"false"quoted booleanControls whether a fake result set containing statement metadata precedes each real result set.field_quote"\""stringSpecifies a single character string used to quote fields in a CSV file.field_sep","stringSpecifies a single character string used to separate fields in a CSV file. Equivalent to the Teradata JDBC DriverFIELD_SEPconnection parameter.govern"true"quoted booleanControls FastLoad and FastExport throttling by Teradata workload management rules. When set totrue(the default), workload management rules may delay a FastLoad or FastExport. When set tofalse, workload management rules will reject rather than delay a FastLoad or FastExport. Equivalent to the Teradata JDBC DriverGOVERNconnection parameter.hoststringSpecifies the database hostname.http_proxystringSpecifies the proxy server URL for HTTP connections to TLS certificate verification CRL and OCSP endpoints. The URL must begin withhttp://and must include a colon:and port number.http_proxy_passwordstringSpecifies the proxy server password for the proxy server identified by thehttp_proxyparameter. This parameter may only be specified in conjunction with thehttp_proxyparameter. When this parameter is omitted, no proxy server password is provided to the proxy server identified by thehttp_proxyparameter.http_proxy_userstringSpecifies the proxy server username for the proxy server identified by thehttp_proxyparameter. This parameter may only be specified in conjunction with thehttp_proxyparameter. When this parameter is omitted, no proxy server username is provided to the proxy server identified by thehttp_proxyparameter.https_port"443"quoted integerSpecifies the database port number for HTTPS/TLS connections. Equivalent to the Teradata JDBC DriverHTTPS_PORTconnection parameter.https_proxystringSpecifies the proxy server URL for HTTPS/TLS connections to the database and to Identity Provider endpoints. The URL must begin withhttp://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 DriverHTTPS_PROXYconnection parameter.https_proxy_passwordstringSpecifies the proxy server password for the proxy server identified by thehttps_proxyparameter. This parameter may only be specified in conjunction with thehttps_proxyparameter. When this parameter is omitted, no proxy server password is provided to the proxy server identified by thehttps_proxyparameter. Equivalent to the Teradata JDBC DriverHTTPS_PROXY_PASSWORDconnection parameter.https_proxy_userstringSpecifies the proxy server username for the proxy server identified by thehttps_proxyparameter. This parameter may only be specified in conjunction with thehttps_proxyparameter. When this parameter is omitted, no proxy server username is provided to the proxy server identified by thehttps_proxyparameter. Equivalent to the Teradata JDBC DriverHTTPS_PROXY_USERconnection parameter.lob_support"true"quoted booleanControls LOB support. Equivalent to the Teradata JDBC DriverLOB_SUPPORTconnection parameter.log"0"quoted integerControls debug logging. Somewhat equivalent to the Teradata JDBC DriverLOGconnection 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.logdatastringSpecifies extra data for the chosen logon authentication method. Equivalent to the Teradata JDBC DriverLOGDATAconnection parameter.logmech"TD2"stringSpecifies the logon authentication method. Equivalent to the Teradata JDBC DriverLOGMECHconnection parameter. Possible case-insensitive values areTD2(the default),BROWSER,JWT,LDAP,KRB5for Kerberos, orTDNEGO. Browser Authentication is supported for Windows and macOS.logon_sequence_numberquoted integerAssociates this session with an existing Logon Sequence Number (LSN) whenconnect_functionis2. The database only permits sessions for the same user to share an LSN. An LSN groups multiple sessions together for workload management. Using an LSN is a three-step process. First, establish a control session withconnect_functionas1, which allocates a new LSN. Second, obtain the LSN from the control session using the escape function{fn teradata_logon_sequence_number}. Third, establish an associated session withconnect_functionas2and the logon sequence number. Equivalent to the Teradata JDBC DriverLOGON_SEQUENCE_NUMBERconnection parameter.logon_timeout"0"quoted integerSpecifies the logon timeout in seconds. Zero means no timeout.manage_error_tables"true"quoted booleanControls whether the driver manages the FastLoad error tables.max_message_body"2097000"quoted integerSpecifies the maximum Response Message size in bytes. Equivalent to the Teradata JDBC DriverMAX_MESSAGE_BODYconnection parameter.oidc_scope"openid"stringSpecifies the OpenID Connect (OIDC) scope to use for Browser Authentication. Beginning with Teradata Database 17.20.03.11, the default scope can be specified in the database'sTdgssUserConfigFile.xmlfile, using theIdPConfigelement'sScopeattribute. Browser Authentication is supported for Windows and macOS. Equivalent to the Teradata JDBC DriverOIDC_SCOPEconnection parameter.oidc_token"access_token"stringSpecifies the kind of OIDC token to use for Browser Authentication. Specifyid_tokento use the id_token instead of the access_token. Browser Authentication is supported for Windows and macOS. Equivalent to the Teradata JDBC DriverOIDC_TOKENconnection parameter.partition"DBC/SQL"stringSpecifies the database partition. Equivalent to the Teradata JDBC DriverPARTITIONconnection parameter.passwordstringSpecifies the database password. Equivalent to the Teradata JDBC DriverPASSWORDconnection parameter.proxy_bypass_hostsstringSpecifies a matching pattern for hostnames and addresses to bypass the proxy server identified by thehttp_proxyand/orhttps_proxyparameter. This parameter may only be specified in conjunction with thehttp_proxyand/orhttps_proxyparameter. Separate multiple hostnames and addresses with a vertical bar|character. Specify an asterisk*as a wildcard character. When this parameter is omitted, the default patternlocalhost|127.*|[::1]bypasses the proxy server identified by thehttp_proxyand/orhttps_proxyparameter for common variations of the loopback address. Equivalent to the Teradata JDBC DriverPROXY_BYPASS_HOSTSconnection parameter.request_timeout"0"quoted integerSpecifies the timeout for executing each SQL request. Zero means no timeout.runstartup"false"quoted booleanControls whether the user'sSTARTUPSQL request is executed after logon. For more information, refer toUser STARTUP SQL Request. Equivalent to the Teradata JDBC DriverRUNSTARTUPconnection parameter.sessionsquoted integerSpecifies the number of data transfer connections for FastLoad or FastExport. The default (recommended) lets the database choose the appropriate number of connections. Equivalent to the Teradata JDBC DriverSESSIONSconnection parameter.sip_support"true"quoted booleanControls whether StatementInfo parcel is used. Equivalent to the Teradata JDBC DriverSIP_SUPPORTconnection parameter.sp_spl"true"quoted booleanControls whether stored procedure source code is saved in the database when a SQL stored procedure is created. Equivalent to the Teradata JDBC DriverSP_SPLconnection parameter.sslcastringSpecifies the file name of a PEM file that contains Certificate Authority (CA) certificates for use withsslmodevaluesVERIFY-CAorVERIFY-FULL. Equivalent to the Teradata JDBC DriverSSLCAconnection parameter.sslcapathstringSpecifies a directory of PEM files that contain Certificate Authority (CA) certificates for use withsslmodevaluesVERIFY-CAorVERIFY-FULL. Only files with an extension of.pemare used. Other files in the specified directory are not used. Equivalent to the Teradata JDBC DriverSSLCAPATHconnection parameter.sslcipherstringSpecifies the TLS cipher for HTTPS/TLS connections. Equivalent to the Teradata JDBC DriverSSLCIPHERconnection parameter.sslcrc"ALLOW"stringControls TLS certificate revocation checking for HTTPS/TLS connections whensslmodeisVERIFY-FULL. This parameter is ignored unlesssslmodeisVERIFY-FULL. Equivalent to the Teradata JDBC DriverSSLCRCconnection parameter. Values are case-insensitive.•ALLOWprovides "soft fail" behavior such that communication failures are ignored during certificate revocation checking.•REQUIREmandates that certificate revocation checking must succeed.sslmode"PREFER"stringSpecifies the mode for connections to the database. Equivalent to the Teradata JDBC DriverSSLMODEconnection parameter. Values are case-insensitive.•DISABLEdisables HTTPS/TLS connections and uses only non-TLS connections.•ALLOWuses non-TLS connections unless the database requires HTTPS/TLS connections.•PREFERuses HTTPS/TLS connections unless the database does not offer HTTPS/TLS connections.•REQUIREuses only HTTPS/TLS connections.•VERIFY-CAuses only HTTPS/TLS connections and verifies that the server certificate is valid and trusted.•VERIFY-FULLuses only HTTPS/TLS connections, verifies that the server certificate is valid and trusted, and verifies that the server certificate matches the database hostname.sslprotocol"TLSv1.2"stringSpecifies the TLS protocol for HTTPS/TLS connections. Equivalent to the Teradata JDBC DriverSSLPROTOCOLconnection parameter.teradata_values"true"quoted booleanControls whetherstror a more specific Python data type is used for certain result set column value types. Refer to theData Typestable below for details.tmode"DEFAULT"stringSpecifies the transaction mode. Equivalent to the Teradata JDBC DriverTMODEconnection parameter. Possible values areDEFAULT(the default),ANSI, orTERA.userstringSpecifies the database username. Equivalent to the Teradata JDBC DriverUSERconnection parameter.COP DiscoveryThe driver provides Communications Processor (COP) discovery behavior when thecopconnection parameter istrueor omitted. COP Discovery is turned off when thecopconnection parameter isfalse.A database system can be composed of multiple database nodes. One or more of the database nodes can be configured to run the database Gateway process. Each database node that runs the database Gateway process is termed a Communications Processor, or COP. COP Discovery refers to the procedure of identifying all the available COP hostnames and their IP addresses. COP hostnames can be defined in DNS, or can be defined in the client system'shostsfile. Teradata strongly recommends that COP hostnames be defined in DNS, rather than the client system'shostsfile. Defining COP hostnames in DNS provides centralized administration, and enables centralized changes to COP hostnames if and when the database is reconfigured.Thecoplastconnection parameter specifies how COP Discovery determines the last COP hostname.Whencoplastisfalseor omitted, or COP Discovery is turned off, then the driver will not perform a DNS lookup for the coplast hostname.Whencoplastistrue, and COP Discovery is turned on, then the driver will first perform a DNS lookup for a coplast hostname to obtain the IP address of the last COP hostname before performing COP Discovery. Subsequently, during COP Discovery, the driver will stop searching for COP hostnames when either an unknown COP hostname is encountered, or a COP hostname is encountered whose IP address matches the IP address of the coplast hostname.Specifyingcoplastastruecan improve performance with DNS that is slow to respond for DNS lookup failures, and is necessary for DNS that never returns a DNS lookup failure.When performing COP Discovery, the driver starts with cop1, which is appended to the database hostname, and then proceeds with cop2, cop3, ..., copN. The driver supports domain-name qualification for COP Discovery and the coplast hostname. Domain-name qualification is recommended, because it can improve performance by avoiding unnecessary DNS lookups for DNS search suffixes.The following table illustrates the DNS lookups performed for a hypothetical three-node database system named "whomooz".No domain name qualificationWith domain name qualification(Recommended)Application-specifieddatabase hostnamewhomoozwhomooz.domain.comDefault: COP Discovery turned on, andcoplastisfalseor omitted,perform DNS lookups until unknown COP hostname is encounteredwhomoozcop1→10.0.0.1whomoozcop2→10.0.0.2whomoozcop3→10.0.0.3whomoozcop4→undefinedwhomoozcop1.domain.com→10.0.0.1whomoozcop2.domain.com→10.0.0.2whomoozcop3.domain.com→10.0.0.3whomoozcop4.domain.com→undefinedCOP Discovery turned on, andcoplastistrue,perform DNS lookups until COP hostname is found whose IP address matches the coplast hostname, or unknown COP hostname is encounteredwhomoozcoplast→10.0.0.3whomoozcop1→10.0.0.1whomoozcop2→10.0.0.2whomoozcop3→10.0.0.3whomoozcoplast.domain.com→10.0.0.3whomoozcop1.domain.com→10.0.0.1whomoozcop2.domain.com→10.0.0.2whomoozcop3.domain.com→10.0.0.3COP Discovery turned off and round-robin DNS,perform one DNS lookup that returns multiple IP addresseswhomooz→10.0.0.1,10.0.0.2,10.0.0.3whomooz.domain.com→10.0.0.1,10.0.0.2,10.0.0.3Round-robin DNS rotates the list of IP addresses automatically to provide load distribution. Round-robin is only possible with DNS, not with the client systemhostsfile.The driver supports the definition of multiple IP addresses for COP hostnames and non-COP hostnames.For the first connection to a particular database system, the driver generates a random number to index into the list of COPs. For each subsequent connection, the driver increments the saved index until it wraps around to the first position. This behavior provides load distribution across all discovered COPs.The driver masks connection failures to down COPs, thereby hiding most connection failures from the client application. An exception is thrown to the application only when all the COPs are down for that database. If a COP is down, the next COP in the sequence (including a wrap-around to the first COP) receives extra connections that were originally destined for the down COP. When multiple IP addresses are defined in DNS for a COP, the driver will attempt to connect to each of the COP's IP addresses, and the COP is considered down only when connection attempts fail to all of the COP's IP addresses.If COP Discovery is turned off, or no COP hostnames are defined in DNS, the driver connects directly to the hostname specified in thehostconnection parameter. This permits load distribution schemes other than the COP Discovery approach. For example, round-robin DNS or a TCP/IP load distribution product can be used. COP Discovery takes precedence over simple database hostname lookup. To use an alternative load distribution scheme, either ensure that no COP hostnames are defined in DNS, or turn off COP Discovery withcopasfalse.Stored Password ProtectionOverviewStored Password Protection enables an application to provide a connection password in encrypted form to the driver.An encrypted password may be specified in the following contexts:A login password specified as thepasswordconnection parameter.A login password specified within thelogdataconnection parameter.If the password, however specified, begins with the prefixENCRYPTED_PASSWORD(then the specified password must follow this format:ENCRYPTED_PASSWORD(file:PasswordEncryptionKeyFileName,file:EncryptedPasswordFileName)Each filename must be preceded by thefile:prefix. ThePasswordEncryptionKeyFileNamemust be separated from theEncryptedPasswordFileNameby a single comma.ThePasswordEncryptionKeyFileNamespecifies the name of a file that contains the password encryption key and associated information. TheEncryptedPasswordFileNamespecifies the name of a file that contains the encrypted password and associated information. The two files are described below.Stored Password Protection is offered by this driver, the Teradata JDBC Driver, and the Teradata SQL Driver for R. These drivers use the same file format.Program TJEncryptPasswordTJEncryptPassword.pyis a sample program to create encrypted password files for use with Stored Password Protection. When the driver is installed, the sample programs are placed in theteradatasql/samplesdirectory under your Python installation directory.This program works in conjunction with Stored Password Protection offered by the driver. This program creates the files containing the password encryption key and encrypted password, which can be subsequently specified via theENCRYPTED_PASSWORD(syntax.You are not required to use this program to create the files containing the password encryption key and encrypted password. You can develop your own software to create the necessary files. You may also use theTJEncryptPassword.javasample program that is available with theTeradata JDBC Driver Reference. The only requirement is that the files must match the format expected by the driver, which is documented below.This program encrypts the password and then immediately decrypts the password, in order to verify that the password can be successfully decrypted. This program mimics the password decryption of the driver, and is intended to openly illustrate its operation and enable scrutiny by the community.The encrypted password is only as safe as the two files. You are responsible for restricting access to the files containing the password encryption key and encrypted password. If an attacker obtains both files, the password can be decrypted. The operating system file permissions for the two files should be as limited and restrictive as possible, to ensure that only the intended operating system userid has access to the files.The two files can be kept on separate physical volumes, to reduce the risk that both files might be lost at the same time. If either or both of the files are located on a network volume, then an encrypted wire protocol can be used to access the network volume, such as sshfs, encrypted NFSv4, or encrypted SMB 3.0.This program accepts eight command-line arguments:ArgumentExampleDescriptionTransformationAES/CBC/NoPaddingSpecifies the transformation in the formAlgorithm/Mode/Padding. Supported transformations are listed in a table below.KeySizeInBits256Specifies the algorithm key size, which governs the encryption strength.MACHmacSHA256Specifies the message authentication code (MAC) algorithmHmacSHA1orHmacSHA256.PasswordEncryptionKeyFileNamePassKey.propertiesSpecifies a filename in the current directory, a relative pathname, or an absolute pathname. The file is created by this program. If the file already exists, it will be overwritten by the new file.EncryptedPasswordFileNameEncPass.propertiesSpecifies a filename in the current directory, a relative pathname, or an absolute pathname. The filename or pathname that must differ from the PasswordEncryptionKeyFileName. The file is created by this program. If the file already exists, it will be overwritten by the new file.HostnamewhomoozSpecifies the database hostname.UsernameguestSpecifies the database username.PasswordpleaseSpecifies the database password to be encrypted. Unicode characters in the password can be specified with the\uXXXXescape sequence.Example CommandsThe TJEncryptPassword program uses the driver to log on to the specified database using the encrypted password, so the driver must have been installed with thepip install teradatasqlcommand.The following commands assume that theTJEncryptPassword.pyprogram file is located in the current directory. When the driver is installed, the sample programs are placed in theteradatasql/samplesdirectory under your Python installation directory. Change your current directory to theteradatasql/samplesdirectory under your Python installation directory.The following example commands illustrate using a 256-bit AES key, and using the HmacSHA256 algorithm.PlatformCommandmacOS or Linuxpython TJEncryptPassword.py AES/CBC/NoPadding 256 HmacSHA256 PassKey.properties EncPass.properties whomooz guest pleaseWindowspy -3 TJEncryptPassword.py AES/CBC/NoPadding 256 HmacSHA256 PassKey.properties EncPass.properties whomooz guest pleasePassword Encryption Key File FormatYou are not required to use the TJEncryptPassword program to create the files containing the password encryption key and encrypted password. You can develop your own software to create the necessary files, but the files must match the format expected by the driver.The password encryption key file is a text file in Java Properties file format, using the ISO 8859-1 character encoding.The file must contain the following string properties:PropertyDescriptionversion=1The version number must be1. This property is required.transformation=Algorithm/Mode/PaddingSpecifies the transformation in the formAlgorithm/Mode/Padding. Supported transformations are listed in a table below. This property is required.algorithm=AlgorithmThis value must correspond to theAlgorithmportion of the transformation. This property is required.match=MatchValueThe password encryption key and encrypted password files must contain the same match value. The match values are compared to ensure that the two specified files are related to each other, serving as a "sanity check" to help avoid configuration errors. This property is required.key=HexDigitsThis value is the password encryption key, encoded as hex digits. This property is required.mac=MACAlgorithmSpecifies the message authentication code (MAC) algorithmHmacSHA1orHmacSHA256. Stored Password Protection performs Encrypt-then-MAC for protection from a padding oracle attack. This property is required.mackey=HexDigitsThis value is the MAC key, encoded as hex digits. This property is required.The TJEncryptPassword program uses a timestamp as a shared match value, but a timestamp is not required. Any shared string can serve as a match value. The timestamp is not related in any way to the encryption of the password, and the timestamp cannot be used to decrypt the password.Encrypted Password File FormatThe encrypted password file is a text file in Java Properties file format, using the ISO 8859-1 character encoding.The file must contain the following string properties:PropertyDescriptionversion=1The version number must be1. This property is required.match=MatchValueThe password encryption key and encrypted password files must contain the same match value. The match values are compared to ensure that the two specified files are related to each other, serving as a "sanity check" to help avoid configuration errors. This property is required.password=HexDigitsThis value is the encrypted password, encoded as hex digits. This property is required.params=HexDigitsThis value contains the cipher algorithm parameters, if any, encoded as hex digits. Some ciphers need algorithm parameters that cannot be derived from the key, such as an initialization vector. This property is optional, depending on whether the cipher algorithm has associated parameters.hash=HexDigitsThis value is the expected message authentication code (MAC), encoded as hex digits. After encryption, the expected MAC is calculated using the ciphertext, transformation name, and algorithm parameters if any. Before decryption, the driver calculates the MAC using the ciphertext, transformation name, and algorithm parameters if any, and verifies that the calculated MAC matches the expected MAC. If the calculated MAC differs from the expected MAC, then either or both of the files may have been tampered with. This property is required.Whileparamsis technically optional, an initialization vector is required by all three block cipher modesCBC,CFB, andOFBthat are supported by the driver. ECB (Electronic Codebook) does not requireparams, but ECB is not supported by the driver.Transformation, Key Size, and MACA transformation is a string that describes the set of operations to be performed on the given input, to produce transformed output. A transformation specifies the name of a cryptographic algorithm such as DES or AES, followed by a feedback mode and padding scheme.The driver supports the following transformations and key sizes.TransformationKey SizeDES/CBC/NoPadding64DES/CBC/PKCS5Padding64DES/CFB/NoPadding64DES/CFB/PKCS5Padding64DES/OFB/NoPadding64DES/OFB/PKCS5Padding64DESede/CBC/NoPadding192DESede/CBC/PKCS5Padding192DESede/CFB/NoPadding192DESede/CFB/PKCS5Padding192DESede/OFB/NoPadding192DESede/OFB/PKCS5Padding192AES/CBC/NoPadding128AES/CBC/NoPadding192AES/CBC/NoPadding256AES/CBC/PKCS5Padding128AES/CBC/PKCS5Padding192AES/CBC/PKCS5Padding256AES/CFB/NoPadding128AES/CFB/NoPadding192AES/CFB/NoPadding256AES/CFB/PKCS5Padding128AES/CFB/PKCS5Padding192AES/CFB/PKCS5Padding256AES/OFB/NoPadding128AES/OFB/NoPadding192AES/OFB/NoPadding256AES/OFB/PKCS5Padding128AES/OFB/PKCS5Padding192AES/OFB/PKCS5Padding256Stored Password Protection uses a symmetric encryption algorithm such as DES or AES, in which the same secret key is used for encryption and decryption of the password. Stored Password Protection does not use an asymmetric encryption algorithm such as RSA, with separate public and private keys.CBC (Cipher Block Chaining) is a block cipher encryption mode. With CBC, each ciphertext block is dependent on all plaintext blocks processed up to that point. CBC is suitable for encrypting data whose total byte count exceeds the algorithm's block size, and is therefore suitable for use with Stored Password Protection.Stored Password Protection hides the password length in the encrypted password file by extending the length of the UTF8-encoded password with trailing null bytes. The length is extended to the next 512-byte boundary.A block cipher with no padding, such asAES/CBC/NoPadding, may only be used to encrypt data whose byte count after extension is a multiple of the algorithm's block size. The 512-byte boundary is compatible with many block ciphers. AES, for example, has a block size of 128 bits (16 bytes), and is therefore compatible with the 512-byte boundary.A block cipher with padding, such asAES/CBC/PKCS5Padding, can be used to encrypt data of any length. However, CBC with padding is vulnerable to a "padding oracle attack", so Stored Password Protection performs Encrypt-then-MAC for protection from a padding oracle attack. MAC algorithmsHmacSHA1andHmacSHA256are supported.The driver does not support block ciphers used as byte-oriented ciphers via modes such asCFB8orOFB8.The strength of the encryption depends on your choice of cipher algorithm and key size.AES uses a 128-bit (16 byte), 192-bit (24 byte), or 256-bit (32 byte) key.DESede uses a 192-bit (24 byte) key. The driver does not support a 128-bit (16 byte) key for DESede.DES uses a 64-bit (8 byte) key.Sharing Files with the Teradata JDBC DriverThis driver and the Teradata JDBC Driver can share the files containing the password encryption key and encrypted password, if you use a transformation, key size, and MAC algorithm that is supported by both drivers.Recommended choices for compatibility areAES/CBC/NoPaddingandHmacSHA256.Use a 256-bit key if your Java environment has the Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files from Oracle.Use a 128-bit key if your Java environment does not have the Unlimited Strength Jurisdiction Policy Files.UseHmacSHA1for compatibility with JDK 1.4.2.File LocationsFor theENCRYPTED_PASSWORD(syntax of the driver, each filename must be preceded by thefile:prefix.
ThePasswordEncryptionKeyFileNamemust be separated from theEncryptedPasswordFileNameby a single comma. The files can be located in the current directory, specified with a relative path, or specified with an absolute path.Example for files in the current directory:ENCRYPTED_PASSWORD(file:JohnDoeKey.properties,file:JohnDoePass.properties)Example with relative paths:ENCRYPTED_PASSWORD(file:../dir1/JohnDoeKey.properties,file:../dir2/JohnDoePass.properties)Example with absolute paths on Windows:ENCRYPTED_PASSWORD(file:c:/dir1/JohnDoeKey.properties,file:c:/dir2/JohnDoePass.properties)Example with absolute paths on Linux:ENCRYPTED_PASSWORD(file:/dir1/JohnDoeKey.properties,file:/dir2/JohnDoePass.properties)Processing SequenceThe two filenames specified for an encrypted password must be accessible to the driver and must conform to the properties file formats described above. The driver raises an exception if the file is not accessible, or the file does not conform to the required file format.The driver verifies that the match values in the two files are present, and match each other. The driver raises an exception if the match values differ from each other. The match values are compared to ensure that the two specified files are related to each other, serving as a "sanity check" to help avoid configuration errors. The TJEncryptPassword program uses a timestamp as a shared match value, but a timestamp is not required. Any shared string can serve as a match value. The timestamp is not related in any way to the encryption of the password, and the timestamp cannot be used to decrypt the password.Before decryption, the driver calculates the MAC using the ciphertext, transformation name, and algorithm parameters if any, and verifies that the calculated MAC matches the expected MAC. The driver raises an exception if the calculated MAC differs from the expected MAC, to indicate that either or both of the files may have been tampered with.Finally, the driver uses the decrypted password to log on to the database.Client AttributesClient Attributes record a variety of information about the client system and client software in the system tablesDBC.SessionTblandDBC.EventLog. Client Attributes are intended to be a replacement for the information recorded in theLogonSourcecolumn of the system tablesDBC.SessionTblandDBC.EventLog.The Client Attributes are recorded at session logon time. Subsequently, the system viewsDBC.SessionInfoVandDBC.LogOnOffVcan be queried to obtain information about the client system and client software on a per-session basis. Client Attribute values may be recorded in the database in either mixed-case or in uppercase, depending on the session character set and other factors. Analysis of recorded Client Attributes must flexibly accommodate either mixed-case or uppercase values.Warning: The information in this section is subject to change in future releases of the driver. Client Attributes can be "mined" for information about client system demographics; however, any applications that parse Client Attribute values must be changed if Client Attribute formats are changed in the future.Client Attributes are not intended to be used for workload management. Instead, query bands are intended for workload management. Any use of Client Attributes for workload management may break if Client Attributes are changed, or augmented, in the future.Client AttributeSourceDescriptionMechanismNamedatabaseThe connection's logon mechanism; for example, TD2, LDAP, etc.ClientIpAddressdatabaseThe client IP address, as determined by the databaseClientTcpPortNumberdatabaseThe connection's client TCP port number, as determined by the databaseClientIPAddrByClientdriverThe client IP address, as determined by the driverClientPortByClientdriverThe connection's client TCP port number, as determined by the driverClientProgramNamedriverThe client program name, followed by a streamlined call stackClientSystemUserIddriverThe client user nameClientOsNamedriverThe client operating system nameClientProcThreadIddriverThe client process IDClientVmNamedriverPython runtime informationClientTdHostNamedriverThe database hostname as specified by the application, without any COP suffixClientCOPSuffixedHostNamedriverThe COP-suffixed database hostname chosen by the driverServerIPAddrByClientdriverThe database node's IP address, as determined by the driverServerPortByClientdriverThe destination port number of the TCP connection to the database node, as determined by the driverClientConfTypedriverThe confidentiality type, as determined by the driverV- TLS used for encryption, with full certificate verificationC- TLS used for encryption, with Certificate Authority (CA) verificationR- TLS used for encryption, with no certificate verificationE- TLS was not attempted, and TDGSS used for encryptionU- TLS was not attempted, and TDGSS encryption depends on central administrationF- TLS was attempted, but the TLS handshake failed, so this is a fallback to using TDGSS for encryptionH- SSLMODE was set to PREFER, but a non-TLS connection was made, and TDGSS encryption depends on central administrationServerConfTypedatabaseThe confidentiality type, as determined by the databaseT- TLS used for encryptionE- TDGSS used for encryptionU- Data transfer is unencryptedClientConfVersiondatabaseThe TLS version as determined by the database, if this is an HTTPS/TLS connectionClientConfCipherSuitedatabaseThe TLS cipher as determined by the database, if this is an HTTPS/TLS connectionClientAttributesExdriverAdditional Client Attributes are available in this column as a list of name=value pairs, each terminated by a semicolon. Individual values can be accessed using theNVPsystem function.PYTHON- The Python versionTZ- The Python current time zoneGO- The Go versionSCS- The session character setCCS- The client character setLOB- Y/N indicator for LOB supportSIP- Y/N indicator for StatementInfo parcel supportTM- The transaction mode indicator A (ANSI) or T (TERA)ENC- Y/N indicator forencryptdataconnection parameterDP- Thedbs_portconnection parameterHP- Thehttps_portconnection parameterSSL- Numeric level corresponding tosslmodeSSLM- Thesslmodeconnection parameterCERT- The TLS certificate statusBA- Y/N indicator for Browser AuthenticationTheCERTattribute indicates the TLS certificate status for an HTTPS/TLS connection. When theCERTattribute indicates the TLS certificate is valid (V) or invalid (I), then additional TLS certificate status details are provided as a series of comma-separated two-letter codes.U- the TLS certificate status is unavailableV- the TLS certificate status is validI- the TLS certificate status is invalidPU- sslca PEM file is unavailable for server certificate verificationPA- server certificate was verified using sslca PEM filePR- server certificate was rejected using sslca PEM fileDU- sslcapath PEM directory is unavailable for server certificate verificationDA- server certificate was verified using sslcapath PEM directoryDR- server certificate was rejected using sslcapath PEM directorySA- server certificate was verified by the systemSR- server certificate was rejected by the systemCY- server certificate passed VERIFY-CA checkCN- server certificate failed VERIFY-CA checkHU- server hostname is unavailable for server certificate matching, because database IP address was specifiedHY- server hostname matches server certificateHN- server hostname does not match server certificateRU- resolved server hostname is unavailable for server certificate matching, because database IP address was specifiedRY- resolved server hostname matches server certificateRN- resolved server hostname does not match server certificateIY- IP address matches server certificateIN- IP address does not match server certificateFY- server certificate passed VERIFY-FULL checkFN- server certificate failed VERIFY-FULL checkLogonSource ColumnTheLogonSourcecolumn is obsolete and has been superseded by Client Attributes. TheLogonSourcecolumn may be deprecated and subsequently removed in future releases of the database.When the driver establishes a connection to the database, the driver composes a string value that is stored in theLogonSourcecolumn of the system tablesDBC.SessionTblandDBC.EventLog. TheLogonSourcecolumn is included in system views such asDBC.SessionInfoVandDBC.LogOnOffV. AllLogonSourcevalues are recorded in the database in uppercase.The driver follows the format documented in the Teradata Data Dictionary, section "System Views Columns Reference", for network-attachedLogonSourcevalues. Network-attachedLogonSourcevalues have eight fields, separated by whitespace. The database composes fields 1 through 3, and the driver composes fields 4 through 8.FieldSourceDescription1databaseThe string(TCP/IP)to indicate the connection type2databaseThe connection's client TCP port number, in hexadecimal3databaseThe client IP address, as determined by the database4driverThe database hostname as specified by the application, without any COP suffix5driverThe client process ID6driverThe client user name7driverThe client program name8driverThe string01 LSSto indicate theLogonSourcestring version01User STARTUP SQL RequestCREATE USERandMODIFY USERcommands provideSTARTUPclauses for specifying SQL commands to establish initial session settings. The following table lists several of the SQL commands that may be used to establish initial session settings.CategorySQL commandDiagnostic settingsDIAGNOSTIC...FOR SESSIONSession query bandSET QUERY_BAND...FOR SESSIONUnicode Pass ThroughSET SESSION CHARACTER SET UNICODE PASS THROUGH ONTransaction isolationSET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVELCollation sequenceSET SESSION COLLATIONTemporal qualifierSET SESSION CURRENT VALIDTIME AND CURRENT TRANSACTIONTIMEDate formatSET SESSION DATEFORMFunction tracingSET SESSION FUNCTION TRACESession time zoneSET TIME ZONEFor example, the following command sets aSTARTUPSQL request for usersusanto establish read-uncommitted transaction isolation after logon.MODIFY USER susan AS STARTUP='SET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL RU'The driver'srunstartupconnection parameter must betrueto execute the user'sSTARTUPSQL request after logon. The default forrunstartupisfalse. If therunstartupconnection parameter is omitted orfalse, then the user'sSTARTUPSQL request will not be executed.Transaction ModeThetmodeconnection parameter enables an application to specify the transaction mode for the connection."tmode":"ANSI"provides American National Standards Institute (ANSI) transaction semantics. This mode is recommended."tmode":"TERA"provides legacy Teradata transaction semantics. This mode is only recommended for legacy applications that require Teradata transaction semantics."tmode":"DEFAULT"provides the default transaction mode configured for the database, which may be either ANSI or TERA mode."tmode":"DEFAULT"is the default when thetmodeconnection parameter is omitted.While ANSI mode is generally recommended, please note that every application is different, and some applications may need to use TERA mode. The following differences between ANSI and TERA mode might affect a typical user or application:Silent truncation of inserted data occurs in TERA mode, but not ANSI mode. In ANSI mode, the database returns an error instead of truncating data.Tables created in ANSI mode areMULTISETby default. Tables created in TERA mode areSETtables by default.For tables created in ANSI mode, character columns areCASESPECIFICby default. For tables created in TERA mode, character columns areNOT CASESPECIFICby default.In ANSI mode, character literals areCASESPECIFIC. In TERA mode, character literals areNOT CASESPECIFIC.The last two behavior differences, taken together, may cause character data comparisons (such as inWHEREclause conditions) to be case-insensitive in TERA mode, but case-sensitive in ANSI mode. This, in turn, can produce different query results in ANSI mode versus TERA mode. Comparing twoNOT CASESPECIFICexpressions is case-insensitive regardless of mode, and comparing aCASESPECIFICexpression to another expression of any kind is case-sensitive regardless of mode. You may explicitlyCASTan expression to beCASESPECIFICorNOT CASESPECIFICto obtain the character data comparison required by your application.The Teradata Reference /SQL Request and Transaction Processingrecommends that ANSI mode be used for all new applications. The primary benefit of using ANSI mode is that inadvertent data truncation is avoided. In contrast, when using TERA mode, silent data truncation can occur when data is inserted, because silent data truncation is a feature of TERA mode.A drawback of using ANSI mode is that you can only call stored procedures that were created using ANSI mode, and you cannot call stored procedures that were created using TERA mode. It may not be possible to switch over to ANSI mode exclusively, because you may have some legacy applications that require TERA mode to work properly. You can work around this drawback by creating your stored procedures twice, in two different users/databases, once using ANSI mode, and once using TERA mode.Refer to the Teradata Reference /SQL Request and Transaction Processingfor complete information regarding the differences between ANSI and TERA transaction modes.Auto-CommitThe driver provides auto-commit on and off functionality for both ANSI and TERA mode.When a connection is first established, it begins with the default auto-commit setting, which is on. When auto-commit is on, the driver is solely responsible for managing transactions, and the driver commits each SQL request that is successfully executed. An application should not execute any transaction management SQL commands when auto-commit is on. An application should not call thecommitmethod or therollbackmethod when auto-commit is on.An application can manage transactions itself by setting the connection's.autocommitattribute toFalseto turn off auto-commit.con.autocommit = FalseWhen auto-commit is off, the driver leaves the current transaction open after each SQL request is executed, and the application is responsible for committing or rolling back the transaction by calling thecommitor therollbackmethod, respectively.Auto-commit remains turned off until the application turns it back on by setting the connection's.autocommitattribute toTrue.con.autocommit = TrueBest practices recommend that an application avoid executing database-vendor-specific transaction management commands such asBT,ET,ABORT,COMMIT, orROLLBACK, because such commands differ from one vendor to another. (They even differ between Teradata's two modes ANSI and TERA.) Instead, best practices recommend that an application only call the standard methodscommitandrollbackfor transaction management.When auto-commit is on in ANSI mode, the driver automatically executesCOMMITafter every successful SQL request.When auto-commit is off in ANSI mode, the driver does not automatically executeCOMMIT. When the application calls thecommitmethod, then the driver executesCOMMIT.When auto-commit is on in TERA mode, the driver does not executeBTorET, unless the application explicitly executesBTorETcommands itself, which is not recommended.When auto-commit is off in TERA mode, the driver executesBTbefore submitting the application's first SQL request of a new transaction. When the application calls thecommitmethod, then the driver executesETuntil the transaction is complete.As part of the wire protocol between the database and Teradata client interface software (such as this driver), each message transmitted from the database to the client has a bit designated to indicate whether the session has a transaction in progress or not. Thus, the client interface software is kept informed as to whether the session has a transaction in progress or not.In TERA mode with auto-commit off, when the application uses the driver to execute a SQL request, if the session does not have a transaction in progress, then the driver automatically executesBTbefore executing the application's SQL request. Subsequently, in TERA mode with auto-commit off, when the application uses the driver to execute another SQL request, and the session already has a transaction in progress, then the driver has no need to executeBTbefore executing the application's SQL request.In TERA mode,BTandETpairs can be nested, and the database keeps track of the nesting level. The outermostBT/ETpair defines the transaction scope; innerBT/ETpairs have no effect on the transaction because the database does not provide actual transaction nesting. To commit the transaction,ETcommands must be repeatedly executed until the nesting is unwound. The Teradata wire protocol bit (mentioned earlier) indicates when the nesting is unwound and the transaction is complete. When the application calls thecommitmethod in TERA mode, the driver repeatedly executesETcommands until the nesting is unwound and the transaction is complete.In rare cases, an application may not follow best practices and may explicitly execute transaction management commands. Such an application must turn off auto-commit before executing transaction management commands such asBT,ET,ABORT,COMMIT, orROLLBACK. The application is responsible for executing the appropriate commands for the transaction mode in effect. TERA mode commands areBT,ET, andABORT. ANSI mode commands areCOMMITandROLLBACK. An application must take special care when opening a transaction in TERA mode with auto-commit off. In TERA mode with auto-commit off, when the application executes a SQL request, if the session does not have a transaction in progress, then the driver automatically executesBTbefore executing the application's SQL request. Therefore, the application should not begin a transaction by executingBT.# TERA mode example showing undesirable BT/ET nesting
con.autocommit = False
cur.execute("BT") # BT automatically executed by the driver before this, and produces a nested BT
cur.execute("insert into mytable1 values(1, 2)")
cur.execute("insert into mytable2 values(3, 4)")
cur.execute("ET") # unwind nesting
cur.execute("ET") # complete transaction

# TERA mode example showing how to avoid BT/ET nesting
con.autocommit = False
cur.execute("insert into mytable1 values(1, 2)") # BT automatically executed by the driver before this
cur.execute("insert into mytable2 values(3, 4)")
cur.execute("ET") # complete transactionPlease note that neither previous example shows best practices. Best practices recommend that an application only call the standard methodscommitandrollbackfor transaction management.# Example showing best practice
con.autocommit = False
cur.execute("insert into mytable1 values(1, 2)")
cur.execute("insert into mytable2 values(3, 4)")
con.commit()Data TypesThe table below lists the database data types supported by the driver, and indicates the corresponding Python data type returned in result set rows.Database data typeResult set Python data typeWithteradata_valuesasfalseBIGINTintBLOBbytesBYTEbytesBYTEINTintCHARstrCLOBstrDATEdatetime.datestrDECIMALdecimal.DecimalstrFLOATfloatINTEGERintINTERVAL YEARstrINTERVAL YEAR TO MONTHstrINTERVAL MONTHstrINTERVAL DAYstrINTERVAL DAY TO HOURstrINTERVAL DAY TO MINUTEstrINTERVAL DAY TO SECONDstrINTERVAL HOURstrINTERVAL HOUR TO MINUTEstrINTERVAL HOUR TO SECONDstrINTERVAL MINUTEstrINTERVAL MINUTE TO SECONDstrINTERVAL SECONDstrNUMBERdecimal.DecimalstrPERIOD(DATE)strPERIOD(TIME)strPERIOD(TIME WITH TIME ZONE)strPERIOD(TIMESTAMP)strPERIOD(TIMESTAMP WITH TIME ZONE)strSMALLINTintTIMEdatetime.timestrTIME WITH TIME ZONEdatetime.timewithtzinfostrTIMESTAMPdatetime.datetimestrTIMESTAMP WITH TIME ZONEdatetime.datetimewithtzinfostrVARBYTEbytesVARCHARstrXMLstrThe table below lists the parameterized SQL bind-value Python data types supported by the driver, and indicates the corresponding database data type transmitted to the server.Bind-value Python data typeDatabase data typebytesVARBYTEdatetime.dateDATEdatetime.datetimeTIMESTAMPdatetime.datetimewithtzinfoTIMESTAMP WITH TIME ZONEdatetime.timeTIMEdatetime.timewithtzinfoTIME WITH TIME ZONEdatetime.timedeltaVARCHARformat compatible withINTERVAL DAY TO SECONDdecimal.DecimalNUMBERfloatFLOATintBIGINTstrVARCHARTransforms are used for SQLARRAYdata values, and they can be transferred to and from the database asVARCHARvalues.Transforms are used for structured UDT data values, and they can be transferred to and from the database asVARCHARvalues.Null ValuesSQLNULLvalues received from the database are returned in result set rows as PythonNonevalues.A PythonNonevalue bound to a question-mark parameter marker is transmitted to the database as aNULLVARCHARvalue.The database does not provide automatic or implicit conversion of aNULLVARCHARvalue to a different destination data type.ForNULLcolumn values in a batch, the driver will automatically convert theNULLvalues to match the data type of the non-NULLvalues in the same column.For solitaryNULLvalues, your application may need to explicitly specify the data type with theteradata_parameterescape function, in order to avoid database error 3532 for non-permitted data type conversion.Given a table with a destination column ofBYTE(4), the database would reject the following SQL with database error 3532 "Conversion between BYTE data and other types is illegal."cur.execute("update mytable set bytecolumn = ?", [None]) # fails with database error 3532To avoid database error 3532 in this situation, your application must use the theteradata_parameterescape function to specify the data type for the question-mark parameter marker.cur.execute("{fn teradata_parameter(1, BYTE(4))}update mytable set bytecolumn = ?", [None])Character Export WidthThe driver always uses the UTF8 session character set, and thecharsetconnection parameter is not supported. Be aware of the database'sCharacter Export Widthbehavior that adds trailing space padding to fixed-widthCHARdata type result set column values when using the UTF8 session character set.The databaseCHAR(n)data type is a fixed-width data type (holdingncharacters), and the database reserves a fixed number of bytes for theCHAR(n)data type in response spools and in network message traffic.UTF8 is a variable-width character encoding scheme that requires a varying number of bytes for each character. When the UTF8 session character set is used, the database reserves the maximum number of bytes that theCHAR(n)data type could occupy in response spools and in network message traffic. When the UTF8 session character set is used, the database appends padding characters to the tail end ofCHAR(n)values smaller than the reserved maximum size, so that theCHAR(n)values all occupy the same fixed number of bytes in response spools and in network message traffic.Work around this drawback by usingCASTorTRIMin SQLSELECTstatements, or in views, to convert fixed-widthCHARdata types toVARCHAR.Given a table with fixed-widthCHARcolumns:CREATE TABLE MyTable (c1 CHAR(10), c2 CHAR(10))Original query that produces trailing space padding:SELECT c1, c2 FROM MyTableModified query with eitherCASTorTRIMto avoid trailing space padding:SELECT CAST(c1 AS VARCHAR(10)), TRIM(TRAILING FROM c2) FROM MyTableOr wrap query in a view withCASTorTRIMto avoid trailing space padding:CREATE VIEW MyView (c1, c2) AS SELECT CAST(c1 AS VARCHAR(10)), TRIM(TRAILING FROM c2) FROM MyTableSELECT c1, c2 FROM MyViewThis technique is also demonstrated in sample programCharPadding.py.Module Constructorsteradatasql.connect(JSONConnectionString,Parameters...)Creates a connection to the database and returns a Connection object.The first parameter is an optional JSON string that defaults toNone. The second and subsequent arguments are optionalkwargs. Specify connection parameters as a JSON string, askwargs, or a combination of the two.When a combination of parameters are specified, connection parameters specified askwargstake precedence over same-named connection parameters specified in the JSON string.teradatasql.Date(Year,Month,Day)Creates and returns adatetime.datevalue.teradatasql.DateFromTicks(Seconds)Creates and returns adatetime.datevalue corresponding to the specified number of seconds after 1970-01-01 00:00:00.teradatasql.Time(Hour,Minute,Second)Creates and returns adatetime.timevalue.teradatasql.TimeFromTicks(Seconds)Creates and returns adatetime.timevalue corresponding to the specified number of seconds after 1970-01-01 00:00:00.teradatasql.Timestamp(Year,Month,Day,Hour,Minute,Second)Creates and returns adatetime.datetimevalue.teradatasql.TimestampFromTicks(Seconds)Creates and returns adatetime.datetimevalue corresponding to the specified number of seconds after 1970-01-01 00:00:00.Module Globalsteradatasql.apilevelString constant"2.0"indicating that the driver implements thePEP-249 Python Database API Specification 2.0.teradatasql.threadsafetyInteger constant2indicating that threads may share this module, and threads may share connections, but threads must not share cursors.teradatasql.paramstyleString constant"qmark"indicating that prepared SQL requests use question-mark parameter markers.Module Exceptionsteradatasql.Erroris the base class for other exceptions.teradatasql.InterfaceErroris raised for errors related to the driver. Not supported yet.teradatasql.DatabaseErroris raised for errors related to the database.teradatasql.DataErroris raised for data value errors such as division by zero. Not supported yet.teradatasql.IntegrityErroris raised for referential integrity violations. Not supported yet.teradatasql.OperationalErroris raised for errors related to the database's operation.teradatasql.ProgrammingErroris raised for SQL object existence errors and SQL syntax errors. Not supported yet.Connection Attributes.autocommitRead/writeboolattribute for the connection's auto-commit setting. Defaults toTruemeaning auto-commit is turned on.Connection Methods.cancel()Attempts to cancel the currently executing SQL request, if one is currently executing. Does nothing if called when no SQL request is executing.This method must be called from a thread other than the thread which is blocked while executing the SQL request..close()Closes the Connection..commit()Commits the current transaction..cursor()Creates and returns a new Cursor object for the Connection..rollback()Rolls back the current transaction.Cursor Attributes.arraysizeRead/writeintattribute specifying the number of rows to fetch at a time with the.fetchmany()method. Defaults to1meaning fetch a single row at a time..connectionRead-only attribute indicating the Cursor's parent Connection object..descriptionRead-only attribute consisting of a sequence of seven-item sequences that each describe a result set column, available after a SQL request is executed..description[Column][0]provides the column name..description[Column][1]provides the column type code as an object comparable to one of the Type Objects listed below..description[Column][2]provides the column display size in characters. Not implemented yet..description[Column][3]provides the column size in bytes..description[Column][4]provides the column precision if applicable, orNoneotherwise..description[Column][5]provides the column scale if applicable, orNoneotherwise..description[Column][6]provides the column nullability asTrueorFalse..rowcountRead-onlyintattribute indicating the number of rows returned from, or affected by, the current SQL statement.Cursor Methods.callproc(ProcedureName,OptionalSequenceOfParameterValues)Calls the stored procedure specified byProcedureName.
Provide the second argument as a sequence ofINandINOUTparameter values to bind the values to question-mark parameter markers in the SQL request.
Specifying parameter values as a mapping is not supported.
Returns a result set consisting of theINOUTparameter output values, if any, followed by any dynamic result sets.OUTparameters are not supported by this method. Use.executeto call a stored procedure withOUTparameters..close()Closes the Cursor..execute(SQLRequest,OptionalSequenceOfParameterValues, ignoreErrors=OptionalSequenceOfIgnoredErrorCodes)Executes the SQL request.
If a sequence of parameter values is provided as the second argument, the values will be bound to question-mark parameter markers in the SQL request. Specifying parameter values as a mapping is not supported.TheignoreErrorsparameter is optional. The ignored error codes must be specified as a sequence of integers..executemany(SQLRequest,SequenceOfSequencesOfParameterValues, ignoreErrors=OptionalSequenceOfIgnoredErrorCodes)Executes the SQL request as an iterated SQL request for the batch of parameter values.
The batch of parameter values must be specified as a sequence of sequences. Specifying parameter values as a mapping is not supported.TheignoreErrorsparameter is optional. The ignored error codes must be specified as a sequence of integers..fetchall()Fetches all remaining rows of the current result set.
Returns a sequence of sequences of column values..fetchmany(OptionalRowCount)Fetches the next series of rows of the current result set.
The argument specifies the number of rows to fetch. If no argument is provided, then the Cursor's.arraysizeattribute will determine the number of rows to fetch.
Returns a sequence of sequences of column values, or an empty sequence to indicate that all rows have been fetched..fetchone()Fetches the next row of the current result set.
Returns a sequence of column values, orNoneto indicate that all rows have been fetched..nextset()Advances to the next result set.
ReturnsTrueif another result set is available, orNoneto indicate that all result sets have been fetched..setinputsizes(SequenceOfTypesOrSizes)Has no effect..setoutputsize(Size,OptionalColumnIndex)Has no effect.Type Objectsteradatasql.BINARYIdentifies a SQLBLOB,BYTE, orVARBYTEcolumn as a binary data type when compared with the Cursor's description attribute..description[Column][1] == teradatasql.BINARYteradatasql.DATETIMEIdentifies a SQLDATE,TIME,TIME WITH TIME ZONE,TIMESTAMP, orTIMESTAMP WITH TIME ZONEcolumn as a date/time data type when compared with the Cursor's description attribute..description[Column][1] == teradatasql.DATETIMEteradatasql.NUMBERIdentifies a SQLBIGINT,BYTEINT,DECIMAL,FLOAT,INTEGER,NUMBER, orSMALLINTcolumn as a numeric data type when compared with the Cursor's description attribute..description[Column][1] == teradatasql.NUMBERteradatasql.STRINGIdentifies a SQLCHAR,CLOB,INTERVAL,PERIOD, orVARCHARcolumn as a character data type when compared with the Cursor's description attribute..description[Column][1] == teradatasql.STRINGEscape SyntaxThe driver accepts most of the JDBC escape clauses offered by the Teradata JDBC Driver.Date and Time LiteralsDate and time literal escape clauses are replaced by the corresponding SQL literal before the SQL request text is transmitted to the database.Literal TypeFormatDate{d 'yyyy-mm-dd'}Time{t 'hh:mm:ss'}Timestamp{ts 'yyyy-mm-dd hh:mm:ss'}Timestamp{ts 'yyyy-mm-dd hh:mm:ss.f'}For timestamp literal escape clauses, the decimal point and fractional digits may be omitted, or 1 to 6 fractional digitsfmay be specified after a decimal point.Scalar FunctionsScalar function escape clauses are replaced by the corresponding SQL expression before the SQL request text is transmitted to the database.Numeric FunctionReturns{fn ABS(number)}Absolute value ofnumber{fn ACOS(float)}Arccosine, in radians, offloat{fn ASIN(float)}Arcsine, in radians, offloat{fn ATAN(float)}Arctangent, in radians, offloat{fn ATAN2(y,x)}Arctangent, in radians, ofy/x{fn CEILING(number)}Smallest integer greater than or equal tonumber{fn COS(float)}Cosine offloatradians{fn COT(float)}Cotangent offloatradians{fn DEGREES(number)}Degrees innumberradians{fn EXP(float)}eraised to the power offloat{fn FLOOR(number)}Largest integer less than or equal tonumber{fn LOG(float)}Natural (basee) logarithm offloat{fn LOG10(float)}Base 10 logarithm offloat{fn MOD(integer1,integer2)}Remainder forinteger1/integer2{fn PI()}The constant pi, approximately equal to 3.14159...{fn POWER(number,integer)}numberraised tointegerpower{fn RADIANS(number)}Radians innumberdegrees{fn RAND(seed)}A random float value such that 0 ≤ value < 1, andseedis ignored{fn ROUND(number,places)}numberrounded toplaces{fn SIGN(number)}-1 ifnumberis negative; 0 ifnumberis 0; 1 ifnumberis positive{fn SIN(float)}Sine offloatradians{fn SQRT(float)}Square root offloat{fn TAN(float)}Tangent offloatradians{fn TRUNCATE(number,places)}numbertruncated toplacesString FunctionReturns{fn ASCII(string)}ASCII code of the first character instring{fn CHAR(code)}Character with ASCIIcode{fn CHAR_LENGTH(string)}Length in characters ofstring{fn CHARACTER_LENGTH(string)}Length in characters ofstring{fn CONCAT(string1,string2)}String formed by concatenatingstring1andstring2{fn DIFFERENCE(string1,string2)}A number from 0 to 4 that indicates the phonetic similarity ofstring1andstring2based on their Soundex codes, such that a larger return value indicates greater phonetic similarity; 0 indicates no similarity, 4 indicates strong similarity{fn INSERT(string1,position,length,string2)}String formed by replacing thelength-character segment ofstring1atpositionwithstring2, available beginning with Teradata Database 15.0{fn LCASE(string)}String formed by replacing all uppercase characters instringwith their lowercase equivalents{fn LEFT(string,count)}Leftmostcountcharacters ofstring{fn LENGTH(string)}Length in characters ofstring{fn LOCATE(string1,string2)}Position instring2of the first occurrence ofstring1, or 0 ifstring2does not containstring1{fn LTRIM(string)}String formed by removing leading spaces fromstring{fn OCTET_LENGTH(string)}Length in octets (bytes) ofstring{fn POSITION(string1INstring2)}Position instring2of the first occurrence ofstring1, or 0 ifstring2does not containstring1{fn REPEAT(string,count)}String formed by repeatingstringcounttimes, available beginning with Teradata Database 15.0{fn REPLACE(string1,string2,string3)}String formed by replacing all occurrences ofstring2instring1withstring3{fn RIGHT(string,count)}Rightmostcountcharacters ofstring, available beginning with Teradata Database 15.0{fn RTRIM(string)}String formed by removing trailing spaces fromstring{fn SOUNDEX(string)}Soundex code forstring{fn SPACE(count)}String consisting ofcountspaces{fn SUBSTRING(string,position,length)}Thelength-character segment ofstringatposition{fn UCASE(string)}String formed by replacing all lowercase characters instringwith their uppercase equivalentsSystem FunctionReturns{fn DATABASE()}Current default database name{fn IFNULL(expression,value)}expressionifexpressionis not NULL, orvalueifexpressionis NULL{fn USER()}Logon user name, which may differ from the current authorized user name afterSET QUERY_BANDsets a proxy userTime/Date FunctionReturns{fn CURDATE()}Current date{fn CURRENT_DATE()}Current date{fn CURRENT_TIME()}Current time{fn CURRENT_TIMESTAMP()}Current date and time{fn CURTIME()}Current time{fn DAYOFMONTH(date)}Integer from 1 to 31 indicating the day of month indate{fn EXTRACT(YEAR FROMvalue)}The year component of the date and/or timevalue{fn EXTRACT(MONTH FROMvalue)}The month component of the date and/or timevalue{fn EXTRACT(DAY FROMvalue)}The day component of the date and/or timevalue{fn EXTRACT(HOUR FROMvalue)}The hour component of the date and/or timevalue{fn EXTRACT(MINUTE FROMvalue)}The minute component of the date and/or timevalue{fn EXTRACT(SECOND FROMvalue)}The second component of the date and/or timevalue{fn HOUR(time)}Integer from 0 to 23 indicating the hour oftime{fn MINUTE(time)}Integer from 0 to 59 indicating the minute oftime{fn MONTH(date)}Integer from 1 to 12 indicating the month ofdate{fn NOW()}Current date and time{fn SECOND(time)}Integer from 0 to 59 indicating the second oftime{fn TIMESTAMPADD(SQL_TSI_YEAR,count,timestamp)}Timestamp formed by addingcountyears totimestamp{fn TIMESTAMPADD(SQL_TSI_MONTH,count,timestamp)}Timestamp formed by addingcountmonths totimestamp{fn TIMESTAMPADD(SQL_TSI_DAY,count,timestamp)}Timestamp formed by addingcountdays totimestamp{fn TIMESTAMPADD(SQL_TSI_HOUR,count,timestamp)}Timestamp formed by addingcounthours totimestamp{fn TIMESTAMPADD(SQL_TSI_MINUTE,count,timestamp)}Timestamp formed by addingcountminutes totimestamp{fn TIMESTAMPADD(SQL_TSI_SECOND,count,timestamp)}Timestamp formed by addingcountseconds totimestamp{fn TIMESTAMPDIFF(SQL_TSI_YEAR,timestamp1,timestamp2)}Number of years by whichtimestamp2exceedstimestamp1{fn TIMESTAMPDIFF(SQL_TSI_MONTH,timestamp1,timestamp2)}Number of months by whichtimestamp2exceedstimestamp1{fn TIMESTAMPDIFF(SQL_TSI_DAY,timestamp1,timestamp2)}Number of days by whichtimestamp2exceedstimestamp1{fn TIMESTAMPDIFF(SQL_TSI_HOUR,timestamp1,timestamp2)}Number of hours by whichtimestamp2exceedstimestamp1{fn TIMESTAMPDIFF(SQL_TSI_MINUTE,timestamp1,timestamp2)}Number of minutes by whichtimestamp2exceedstimestamp1{fn TIMESTAMPDIFF(SQL_TSI_SECOND,timestamp1,timestamp2)}Number of seconds by whichtimestamp2exceedstimestamp1{fn YEAR(date)}The year ofdateConversion FunctionsConversion function escape clauses are replaced by the corresponding SQL expression before the SQL request text is transmitted to the database.Conversion FunctionReturns{fn CONVERT(value, SQL_BIGINT)}valueconverted to SQLBIGINT{fn CONVERT(value, SQL_BINARY(size))}valueconverted to SQLBYTE(size){fn CONVERT(value, SQL_CHAR(size))}valueconverted to SQLCHAR(size){fn CONVERT(value, SQL_DATE)}valueconverted to SQLDATE{fn CONVERT(value, SQL_DECIMAL(precision,scale))}valueconverted to SQLDECIMAL(precision,scale){fn CONVERT(value, SQL_DOUBLE)}valueconverted to SQLDOUBLE PRECISION, a synonym forFLOAT{fn CONVERT(value, SQL_FLOAT)}valueconverted to SQLFLOAT{fn CONVERT(value, SQL_INTEGER)}valueconverted to SQLINTEGER{fn CONVERT(value, SQL_LONGVARBINARY)}valueconverted to SQLVARBYTE(64000){fn CONVERT(value, SQL_LONGVARCHAR)}valueconverted to SQLLONG VARCHAR{fn CONVERT(value, SQL_NUMERIC)}valueconverted to SQLNUMBER{fn CONVERT(value, SQL_SMALLINT)}valueconverted to SQLSMALLINT{fn CONVERT(value, SQL_TIME(scale))}valueconverted to SQLTIME(scale){fn CONVERT(value, SQL_TIMESTAMP(scale))}valueconverted to SQLTIMESTAMP(scale){fn CONVERT(value, SQL_TINYINT)}valueconverted to SQLBYTEINT{fn CONVERT(value, SQL_VARBINARY(size))}valueconverted to SQLVARBYTE(size){fn CONVERT(value, SQL_VARCHAR(size))}valueconverted to SQLVARCHAR(size)LIKE Predicate Escape CharacterWithin aLIKEpredicate'spatternargument, the characters%(percent) and_(underscore) serve as wildcards.
To interpret a particular wildcard character literally in aLIKEpredicate'spatternargument, the wildcard character must be preceded by an escape character, and the escape character must be indicated in theLIKEpredicate'sESCAPEclause.LIKEpredicate escape character escape clauses are replaced by the corresponding SQL clause before the SQL request text is transmitted to the database.{escape 'EscapeCharacter'}The escape clause must be specified immediately after theLIKEpredicate that it applies to.Outer JoinsOuter join escape clauses are replaced by the corresponding SQL clause before the SQL request text is transmitted to the database.{ojTableNameOptionalCorrelationNameLEFT OUTER JOINTableNameOptionalCorrelationNameONJoinCondition}{ojTableNameOptionalCorrelationNameRIGHT OUTER JOINTableNameOptionalCorrelationNameONJoinCondition}{ojTableNameOptionalCorrelationNameFULL OUTER JOINTableNameOptionalCorrelationNameONJoinCondition}Stored Procedure CallsStored procedure call escape clauses are replaced by the corresponding SQL clause before the SQL request text is transmitted to the database.{callProcedureName}{callProcedureName(CommaSeparatedParameterValues...)}Native SQLWhen a SQL request contains the native SQL escape clause, all escape clauses are replaced in the SQL request text, and the modified SQL request text is returned to the application as a result set containing a single row and a single VARCHAR column. The SQL request text is not transmitted to the database, and the SQL request is not executed. The native SQL escape clause mimics the functionality of the JDBC APIConnection.nativeSQLmethod.{fn teradata_nativesql}Connection FunctionsThe following table lists connection function escape clauses that are intended for use with the native SQL escape clause{fn teradata_nativesql}.These functions provide information about the connection, or control the behavior of the connection.
Functions that provide information return locally-cached information and avoid a round-trip to the database.
Connection function escape clauses are replaced by the returned information before the SQL request text is transmitted to the database.Connection FunctionReturns{fn teradata_amp_count}Number of AMPs of the database system{fn teradata_database_version}Version number of the database{fn teradata_driver_version}Version number of the driver{fn teradata_get_errors}Errors from the most recent batch operation{fn teradata_get_warnings}Warnings from an operation that completed with warnings{fn teradata_getloglevel}Current log level{fn teradata_go_runtime}Go runtime version for the Teradata GoSQL Driver{fn teradata_logon_sequence_number}Session's Logon Sequence Number, if available{fn teradata_program_name}Executable program name{fn teradata_provide(config_response)}Config Response parcel contents in JSON format{fn teradata_provide(connection_id)}Connection's unique identifier within the process{fn teradata_provide(default_connection)}falseindicating this is not a stored procedure default connection{fn teradata_provide(gateway_config)}Gateway Config parcel contents in JSON format{fn teradata_provide(governed)}trueorfalseindicating thegovernconnection parameter setting{fn teradata_provide(host_id)}Session's host ID{fn teradata_provide(java_charset_name)}UTF8{fn teradata_provide(lob_support)}trueorfalseindicating this connection's LOB support{fn teradata_provide(local_address)}Local address of the connection's TCP socket{fn teradata_provide(local_port)}Local port of the connection's TCP socket{fn teradata_provide(original_hostname)}Original specified database hostname{fn teradata_provide(redrive_active)}trueorfalseindicating whether this connection has Redrive active{fn teradata_provide(remote_address)}Hostname (if available) and IP address of the connected database node{fn teradata_provide(remote_port)}TCP port number of the database{fn teradata_provide(rnp_active)}trueorfalseindicating whether this connection has Recoverable Network Protocol active{fn teradata_provide(session_charset_code)}Session character set code191{fn teradata_provide(session_charset_name)}Session character set nameUTF8{fn teradata_provide(sip_support)}trueorfalseindicating this connection's StatementInfo parcel support{fn teradata_provide(transaction_mode)}Session's transaction mode,ANSIorTERA{fn teradata_provide(uses_check_workload)}trueorfalseindicating whether this connection usesCHECK WORKLOAD{fn teradata_session_number}Session numberRequest-Scope FunctionsThe following table lists request-scope function escape clauses that are intended for use with the Cursor.executeor.executemanymethods.These functions control the behavior of the corresponding Cursor, and are limited in scope to the particular SQL request in which they are specified.
Request-scope function escape clauses are removed before the SQL request text is transmitted to the database.Request-Scope FunctionEffect{fn teradata_agkr(Option)}Executes the SQL request with Auto-Generated Key Retrieval (AGKR)OptionC(identity column value) orR(entire row){fn teradata_clobtranslate(Option)}Executes the SQL request with CLOB translateOptionU(unlocked) or the defaultL(locked){fn teradata_error_query_count(Number)}Specifies how many times the driver will attempt to query FastLoad Error Table 1 after a FastLoad operation. Takes precedence over theerror_query_countconnection parameter.{fn teradata_error_query_interval(Milliseconds)}Specifies how many milliseconds the driver will wait between attempts to query FastLoad Error Table 1. Takes precedence over theerror_query_intervalconnection parameter.{fn teradata_error_table_1_suffix(Suffix)}Specifies the suffix to append to the name of FastLoad error table 1. Takes precedence over theerror_table_1_suffixconnection parameter.{fn teradata_error_table_2_suffix(Suffix)}Specifies the suffix to append to the name of FastLoad error table 2. Takes precedence over theerror_table_2_suffixconnection parameter.{fn teradata_error_table_database(DbName)}Specifies the parent database name for FastLoad error tables 1 and 2. Takes precedence over theerror_table_databaseconnection parameter.{fn teradata_failfast}Reject ("fail fast") this SQL request rather than delay by a workload management rule or throttle{fn teradata_fake_result_sets}A fake result set containing statement metadata precedes each real result set. Takes precedence over thefake_result_setsconnection parameter.{fn teradata_fake_result_sets_off}Turns off fake result sets for this SQL request. Takes precedence over thefake_result_setsconnection parameter.{fn teradata_field_quote(String)}Specifies a single-character string used to quote fields in a CSV file. Takes precedence over thefield_quoteconnection parameter.{fn teradata_field_sep(String)}Specifies a single-character string used to separate fields in a CSV file. Takes precedence over thefield_sepconnection parameter.{fn teradata_govern_off}Teradata workload management rules will reject rather than delay a FastLoad or FastExport. Takes precedence over thegovernconnection parameter.{fn teradata_govern_on}Teradata workload management rules may delay a FastLoad or FastExport. Takes precedence over thegovernconnection parameter.{fn teradata_lobselect(Option)}Executes the SQL request with LOB selectOptionS(spool-scoped LOB locators),T(transaction-scoped LOB locators), or the defaultI(inline materialized LOB values){fn teradata_manage_error_tables_off}Turns off FastLoad error table management for this request. Takes precedence over themanage_error_tablesconnection parameter.{fn teradata_manage_error_tables_on}Turns on FastLoad error table management for this request. Takes precedence over themanage_error_tablesconnection parameter.{fn teradata_parameter(Index,DataType)Transmits parameterIndexbind values asDataType{fn teradata_provide(request_scope_column_name_off)}Provides the default column name behavior for this SQL request. Takes precedence over thecolumn_nameconnection parameter.{fn teradata_provide(request_scope_lob_support_off)}Turns off LOB support for this SQL request. Takes precedence over thelob_supportconnection parameter.{fn teradata_provide(request_scope_refresh_rsmd)}Executes the SQL request with the default request processing optionB(both){fn teradata_provide(request_scope_sip_support_off)}Turns off StatementInfo parcel support for this SQL request. Takes precedence over thesip_supportconnection parameter.{fn teradata_read_csv(CSVFileName)}Executes a batch insert using the bind parameter values read from the specified CSV file for either a SQL batch insert or a FastLoad{fn teradata_request_timeout(Seconds)}Specifies the timeout for executing the SQL request. Zero means no timeout. Takes precedence over therequest_timeoutconnection parameter.{fn teradata_require_fastexport}Specifies that FastExport is required for the SQL request{fn teradata_require_fastload}Specifies that FastLoad is required for the SQL request{fn teradata_rpo(RequestProcessingOption)}Executes the SQL request withRequestProcessingOptionS(prepare),E(execute), or the defaultB(both){fn teradata_sessions(Number)}Specifies theNumberof data transfer connections for FastLoad or FastExport. Takes precedence over thesessionsconnection parameter.{fn teradata_try_fastexport}Tries to use FastExport for the SQL request{fn teradata_try_fastload}Tries to use FastLoad for the SQL request{fn teradata_untrusted}Marks the SQL request as untrusted; not implemented yet{fn teradata_values_off}Turns offteradata_valuesfor this SQL request. Takes precedence over theteradata_valuesconnection parameter. Refer to theData Typestable for details.{fn teradata_values_on}Turns onteradata_valuesfor this SQL request. Takes precedence over theteradata_valuesconnection parameter. Refer to theData Typestable for details.{fn teradata_write_csv(CSVFileName)}Exports one or more result sets from a SQL request or a FastExport to the specified CSV file or filesTheteradata_field_sepandteradata_field_quoteescape functions have a single-character string argument. The string argument must follow SQL literal syntax. The string argument may be enclosed in single-quote (') characters or double-quote (") characters.To represent a single-quote character in a string enclosed in single-quote characters, you must repeat the single-quote character.{fn teradata_field_quote('''')}To represent a double-quote character in a string enclosed in double-quote characters, you must repeat the double-quote character.{fn teradata_field_quote("""")}FastLoadThe driver offers FastLoad, which opens multiple database connections to transfer data in parallel.Please be aware that this is an early release of the FastLoad feature. Think of it as a beta or preview version. It works, but does not yet offer all the features that JDBC FastLoad offers. FastLoad is still under active development, and we will continue to enhance it in subsequent builds.FastLoad has limitations and cannot be used in all cases as a substitute for SQL batch insert:FastLoad can only load into an empty permanent table.FastLoad cannot load additional rows into a table that already contains rows.FastLoad cannot load into a volatile table or global temporary table.FastLoad cannot load duplicate rows into aMULTISETtable with a primary index.Do not use FastLoad to load only a few rows, because FastLoad opens extra connections to the database, which is time consuming.Only use FastLoad to load many rows (at least 100,000 rows) so that the row-loading performance gain exceeds the overhead of opening additional connections.FastLoad does not support all database data types. For example,BLOBandCLOBare not supported.FastLoad requires StatementInfo parcel support to be enabled.FastLoad locks the destination table.If Online Archive encounters a table being loaded with FastLoad, online archiving of that table will be bypassed.Your application can bind a single row of data for FastLoad, but that is not recommended because the overhead of opening additional connections causes FastLoad to be slower than a regular SQLINSERTfor a single row.How to use FastLoad:Auto-commit should be turned off before beginning a FastLoad.FastLoad is intended for binding many rows at a time. Each batch of rows must be able to fit into memory.When auto-commit is turned off, your application can insert multiple batches in a loop for the same FastLoad.Each column's data type must be consistent across every row in every batch over the entire FastLoad.The column values of the first row of the first batch dictate what the column data types must be in all subsequent rows and all subsequent batches of the FastLoad.FastLoad opens multiple data transfer connections to the database. FastLoad evenly distributes each batch of rows across the available data transfer connections, and uses overlapped I/O to send and receive messages in parallel.To use FastLoad, your application must prepend one of the following escape functions to theINSERTstatement:{fn teradata_try_fastload}tries to use FastLoad for theINSERTstatement, and automatically executes theINSERTas a regular SQL statement when theINSERTis not compatible with FastLoad.{fn teradata_require_fastload}requires FastLoad for theINSERTstatement, and fails with an error when theINSERTis not compatible with FastLoad.Your application can prepend other optional escape functions to theINSERTstatement:{fn teradata_sessions(n)}specifies the number of data transfer connections to be opened, and is capped at the number of AMPs. The default is the smaller of 8 or the number of AMPs. We recommend avoiding this function to let the driver ask the database how many data transfer connections should be used.{fn teradata_error_table_1_suffix(suffix)}specifies the suffix to append to the name of FastLoad error table 1. The default suffix is_ERR_1.{fn teradata_error_table_2_suffix(suffix)}specifies the suffix to append to the name of FastLoad error table 2. The default suffix is_ERR_2.{fn teradata_error_table_database(dbname)}specifies the parent database name for FastLoad error tables 1 and 2. By default, the FastLoad error tables reside in the same database as the destination table.{fn teradata_govern_on}or{fn teradata_govern_off}specifies whether Teradata workload management rules may delay or reject the FastLoad. Takes precedence over thegovernconnection parameter.After beginning a FastLoad, your application can obtain the Logon Sequence Number (LSN) assigned to the FastLoad by prepending the following escape functions to theINSERTstatement:{fn teradata_nativesql}{fn teradata_logon_sequence_number}returns the string form of an integer representing the Logon Sequence Number (LSN) for the FastLoad. Returns an empty string if the request is not a FastLoad.FastLoad does not stop for data errors such as constraint violations or unique primary index violations. After inserting each batch of rows, your application must obtain warning and error information by prepending the following escape functions to theINSERTstatement:{fn teradata_nativesql}{fn teradata_get_warnings}returns in one string all warnings generated by FastLoad for the request.{fn teradata_nativesql}{fn teradata_get_errors}returns in one string all data errors observed by FastLoad for the most recent batch. The data errors are obtained from FastLoad error table 1, for problems such as constraint violations, data type conversion errors, and unavailable AMP conditions.Your application ends FastLoad by committing or rolling back the current transaction. After commit or rollback, your application must obtain warning and error information by prepending the following escape functions to theINSERTstatement:{fn teradata_nativesql}{fn teradata_get_warnings}returns in one string all warnings generated by FastLoad for the commit or rollback. The warnings are obtained from FastLoad error table 2, for problems such as duplicate rows.{fn teradata_nativesql}{fn teradata_get_errors}returns in one string all data errors observed by FastLoad for the commit or rollback. The data errors are obtained from FastLoad error table 2, for problems such as unique primary index violations.Warning and error information remains available until the next batch is inserted or until the commit or rollback. Each batch execution clears the prior warnings and errors. Each commit or rollback clears the prior warnings and errors.FastExportThe driver offers FastExport, which opens multiple database connections to transfer data in parallel.Please be aware that this is an early release of the FastExport feature. Think of it as a beta or preview version. It works, but does not yet offer all the features that JDBC FastExport offers. FastExport is still under active development, and we will continue to enhance it in subsequent builds.FastExport has limitations and cannot be used in all cases as a substitute for SQL queries:FastExport cannot query a volatile table or global temporary table.FastExport supports single-statement SQLSELECT, and supports multi-statement requests composed of multiple SQLSELECTstatements only.FastExport supports question-mark parameter markers inWHEREclause conditions. However, the database does not permit the equal=operator for primary or unique secondary indexes, and will return database error 3695 "A Single AMP Select statement has been issued in FastExport".Do not use FastExport to fetch only a few rows, because FastExport opens extra connections to the database, which is time consuming.Only use FastExport to fetch many rows (at least 100,000 rows) so that the row-fetching performance gain exceeds the overhead of opening additional connections.FastExport does not support all database data types. For example,BLOBandCLOBare not supported.For best efficiency, do not useGROUP BYandORDER BYclauses with FastExport.FastExport's result set ordering behavior may differ from a regular SQL query. In particular, a query containing an ordered analytic function may not produce an ordered result set. Use anORDER BYclause to guarantee result set order.FastExport opens multiple data transfer connections to the database. FastExport uses overlapped I/O to send and receive messages in parallel.To use FastExport, your application must prepend one of the following escape functions to the query:{fn teradata_try_fastexport}tries to use FastExport for the query, and automatically executes the query as a regular SQL query when the query is not compatible with FastExport.{fn teradata_require_fastexport}requires FastExport for the query, and fails with an error when the query is not compatible with FastExport.Your application can prepend other optional escape functions to the query:{fn teradata_sessions(n)}specifies the number of data transfer connections to be opened, and is capped at the number of AMPs. The default is the smaller of 8 or the number of AMPs. We recommend avoiding this function to let the driver ask the database how many data transfer connections should be used.{fn teradata_govern_on}or{fn teradata_govern_off}specifies whether Teradata workload management rules may delay or reject the FastExport. Takes precedence over thegovernconnection parameter.After beginning a FastExport, your application can obtain the Logon Sequence Number (LSN) assigned to the FastExport by prepending the following escape functions to the query:{fn teradata_nativesql}{fn teradata_logon_sequence_number}returns the string form of an integer representing the Logon Sequence Number (LSN) for the FastExport. Returns an empty string if the request is not a FastExport.CSV Batch InsertsThe driver can read batch insert bind values from a CSV (comma separated values) file. This feature can be used with SQL batch inserts and with FastLoad.To specify batch insert bind values in a CSV file, the application prepends the escape function{fn teradata_read_csv(CSVFileName)}to theINSERTstatement.The application can specify batch insert bind values in a CSV file, or specify bind parameter values, but not both together. The driver returns an error if both are specified together.Considerations when using a CSV file:Each record is on a separate line of the CSV file. Records are delimited by line breaks (CRLF). The last record in the file may or may not have an ending line break.The first line of the CSV file is a header line. The header line lists the column names separated by the field separator (e.g.col1,col2,col3).The field separator defaults to the comma character (,). You can specify a different field separator character with thefield_sepconnection parameter or with theteradata_field_sepescape function. The specified field separator character must match the actual separator character used in the CSV file.Each field can optionally be enclosed by the field quote character, which defaults to the double-quote character (e.g."abc",123,efg). You can specify a different field quote character with thefield_quoteconnection parameter or with theteradata_field_quoteescape function. The field quote character must match the actual field quote character used in the CSV file.The field separator and field quote characters cannot be set to the same value. The field separator and field quote characters must be legal UTF-8 characters and cannot be line feed (\n) or carriage return (\r).Field quote characters are only permitted in fields enclosed by field quote characters. Field quote characters must not appear inside unquoted fields (e.g. not allowedab"cd"ef,1,abc).To include a field quote character in a quoted field, the field quote character must be repeated (e.g."abc""efg""dh",123,xyz).Line breaks, field quote characters, and field separators may be included in a quoted field (e.g."abc,efg\ndh",123,xyz).Specify aNULLvalue in the CSV file with an empty value between commas (e.g.1,,456).A zero-length quoted string specifies a zero-length non-NULLstring, not aNULLvalue (e.g.1,"",456).Not all data types are supported. For example,BLOB,BYTE, andVARBYTEare not supported.A field length greater than 64KB is transmitted to the database as aDEFERRED CLOBfor a SQL batch insert. A field length greater than 64KB is not supported with FastLoad.Limitations when using CSV batch inserts:Bound parameter values cannot be specified in the execute method when using the escape function{fn teradata_read_csv(CSVFileName)}.The CSV file must contain at least one valid record in addition to the header line containing the column names.For FastLoad, the insert operation will fail if the CSV file is improperly formatted and a parser error occurs.For SQL batch insert, some records may be inserted before a parsing error occurs. A list of the parser errors will be returned. Each parser error will include the line number (starting at line 1) and the column number (starting at zero).Using a CSV file with FastLoad has the same limitations and is used the same way as described in theFastLoadsection.CSV Export ResultsThe driver can export query results to CSV files. This feature can be used with SQL query results, with calls to stored procedures, and with FastExport.To export a result set to a CSV file, the application prepends the escape function{fn teradata_write_csv(CSVFileName)}to the SQL request text.If the query returns multiple result sets, each result set will be written to a separate file. The file name is varied by inserting the string "_N" between the specified file name and file type extension (e.g.fileName.csv,fileName_1.csv,fileName_2.csv). If no file type extension is specified, then the suffix "_N" is appended to the end of the file name (e.g.fileName,fileName_1,fileName_2).A stored procedure call that produces multiple dynamic result sets behaves like other SQL requests that return multiple result sets. The stored procedures's output parameter values are exported as the first CSV file.Example of a SQL request that returns multiple results:{fn teradata_write_csv(myFile.csv)}select 'abc' ; select 123CSV File NameContentmyFile.csvFirst result setmyFile_1.csvSecond result setTo obtain the metadata for each result set, use the escape function{fn teradata_fake_result_sets}. A fake result set containing the metadata will be written to a file preceding each real result set.Example of a query that returns multiple result sets with metadata:{fn teradata_fake_result_sets}{fn teradata_write_csv(myFile.csv)}select 'abc' ; select 123CSV File NameContentmyFile.csvFake result set containing the metadata for the first result setmyFile_1.csvFirst result setmyFile_2.csvFake result set containing the metadata for the second result setmyFile_3.csvSecond result setExported CSV files have the following characteristics:Each record is on a separate line of the CSV file. Records are delimited by line breaks (CRLF).Column values are separated by the field separator character, which defaults to the comma character (,). You can specify a different field separator character with thefield_sepconnection parameter or with theteradata_field_sepescape function.The first line of the CSV file is a header line. The header line lists the column names separated by the field separator (e.g.col1,col2,col3).When necessary, column values are enclosed by the field quote character, which defaults to the double-quote character ("). You can specify a different field quote character with thefield_quoteconnection parameter or with theteradata_field_quoteescape function.The field separator and field quote characters cannot be set to the same value. The field separator and field quote characters must be legal UTF-8 characters and cannot be line feed (\n) or carriage return (\r).If a column value contains line breaks, field quote characters, and/or field separators in a field, the value is quoted with the field quote character.If a column value contains a field quote character, the value is quoted and the field quote character is repeated. For example, column valueabc"defis exported as"abc""def".ANULLvalue is exported to the CSV file as an empty value between field separators (e.g.123,,456).A non-NULLzero-length character value is exported as a zero-length quoted string (e.g.123,"",456).Limitations when exporting to CSV files:When the application chooses to export results to a CSV file, the results are not available for the application to fetch in memory.A warning is returned if the application specifies an export CSV file for a SQL statement that does not produce a result set.Exporting a CSV file with FastExport has the same limitations and is used the same way as described in theFastExportsection.Not all data types are supported. For example,BLOB,BYTE, andVARBYTEare not supported and if one of these column types are present in the result set, an error will be returned.CLOB,XML,JSON, andDATASET STORAGE FORMAT CSVdata types are supported for SQL query results and are exported as string values, but these data types are not supported by FastExport.Change Log20.0.0.7- February 1, 2024GOSQL-189 improved error messages for missing or invalid logmech valueGOSQL-190 Go TeraGSS accommodate DH/CI bypass flag in JWT token header20.0.0.6- January 19, 2024GOSQL-183 TLS certificate verification for Identity Provider endpoints20.0.0.5- January 17, 2024GOSQL-151 proxy server support20.0.0.4- January 9, 2024Build DLL and shared library with Go 1.20.1220.0.0.2- December 8, 2023Improved exception message for query timeoutNew sample programs CancelSleep.py and MultiThread.py20.0.0.1- November 16, 2023Build DLL and shared library with Go 1.20.1120.0.0.0- November 7, 2023TDGSS-7022 Go TeraGSS Phase 1TDGSS-7232 Go TeraGSS Phase 2TDGSS-7233 Go TeraGSS Phase 3TDGSS-8123 Integrate Go TeraGSS with the GoSQL Driver phase 1TDGSS-8345 Go TeraGSS Phase 4TDGSS-9050 Integrate Go TeraGSS with the GoSQL Driver phase 2GOSQL-148 TDNEGO logon mechanism for Go TeraGSSGOSQL-158 switch to Go TeraGSSGOSQL-181 improve TDNEGO interoperability with Kerberos17.20.0.32- October 23, 2023GOSQL-179 fake result sets add SPParameterDirection to ColumnMetadata and ParameterMetadataGOSQL-180 fake result sets add stored procedure IN parameters to ParameterMetadata17.20.0.31- September 27, 2023GOSQL-176 better error message for missing host connection parameter17.20.0.30- September 19, 2023GOSQL-175 avoid panic: cannot create context from nil parentPYDBAPI-122 provide py.typed filePYDBAPI-123 autocommit property for TeradataConnection17.20.0.29- September 5, 2023Build DLL and shared library with Go 1.19.12Requires 64-bit Python 3.7 or later and ends support for older versions of PythonAdded sample program InsertLob.py17.20.0.28- July 21, 2023Build DLL and shared library with Go 1.19.11UTC match values for sample programTJEncryptPassword.py17.20.0.27- June 23, 2023Additional changes for GOSQL-128 use OIDC scope from Gateway Config parcel17.20.0.26- June 15, 2023GOSQL-165 Auto-Generated Key Retrieval (AGKR)GOSQL-167 use loopback IP address for OIDC redirect17.20.0.25- June 2, 2023GOSQL-142 sp_spl connection parameterfake result set columns StatementNumber and WarningCode are now INTEGER17.20.0.24- May 23, 2023GOSQL-41 escape function teradata_provide(request_scope_column_name_off)GOSQL-124 runstartup connection parameter17.20.0.23- May 19, 2023GOSQL-157 logon_timeout connection parameter17.20.0.22- May 16, 2023Build DLL and shared library with Go 1.19.917.20.0.21- May 15, 2023GOSQL-128 use OIDC scope from Gateway Config parcel17.20.0.20- May 5, 2023GOSQL-155 teradata_provide(gateway_config) teradata_provide(governed) teradata_provide(uses_check_workload)17.20.0.19- March 30, 2023GOSQL-129 TLS certificate revocation checking with CRLGOSQL-130 TLS certificate revocation checking with OCSP (not OCSP stapling)GOSQL-132 sslcrc connection parameter17.20.0.18- March 27, 2023GOSQL-146 FastLoad and FastExport Unicode Pass Through support17.20.0.17- March 24, 2023Build DLL and shared library with Go 1.19.7GOSQL-136 escape functions teradata_manage_error_tables_off and teradata_manage_error_tables_onGOSQL-139 allow alternate LOCATOR(type) syntax for teradata_parameter escape functionGOSQL-145 connection parameters error_query_count, error_query_interval, error_table_1_suffix, error_table_2_suffix, error_table_database, manage_error_tables, sessions17.20.0.16- February 21, 2023GOSQL-138 avoid panic for aborted session17.20.0.15- February 16, 2023GOSQL-137 limit the max number of records in a CSV batch17.20.0.14- January 19, 2023GOSQL-24 Asynchronous abort SQL request executionGOSQL-134 escape function teradata_request_timeoutGOSQL-135 connection parameter request_timeoutPYDBAPI-114 Connection.cancel method to cancel executing SQL request17.20.0.13- January 17, 2023GOSQL-133 return FastLoad errors for FastLoad with teradata_read_csv17.20.0.12- December 2, 2022Build DLL and shared library with Go 1.19.3GOSQL-126 escape functions teradata_values_off and teradata_values_on17.20.0.11- November 1, 2022GOSQL-125 FastLoad FastExport govern support for fake_result_sets=trueGOSQL-127 substitute dash for unavailable program name in Client Attributes17.20.0.10- October 27, 2022GOSQL-67 FastLoad FastExport workload managementGOSQL-120 govern connection parameterGOSQL-123 conditional use of Statement Independence depending on database setting17.20.0.9- October 25, 2022Build DLL and shared library with Go 1.18.717.20.0.8- October 19, 2022GOSQL-122 case-insensitive VERIFY-FULL17.20.0.7- September 27, 2022Avoid Kerberos logon failure17.20.0.6- September 19, 2022Build DLL and shared library with Go 1.18.617.20.0.5- September 15, 2022Additional changes for GOSQL-119 avoid nil pointer dereference for FastExport CSV error17.20.0.4- September 14, 2022GOSQL-87 support Mac ARM without RosettaGOSQL-119 avoid nil pointer dereference for FastExport CSV error17.20.0.3- September 6, 2022GOSQL-118 teradata_write_csv support for queries containing commas17.20.0.2- August 23, 2022GOSQL-117 browser_tab_timeout connection parameter17.20.0.1- August 11, 2022Build DLL and shared library with Go 1.18.517.20.0.0- June 16, 2022GOSQL-74 FastLoad support for connection parameter fake_result_sets=true17.10.0.16- June 6, 2022GOSQL-106 indicate unavailable TLS certificate status with ClientAttributesEx CERT=U17.10.0.15- June 2, 2022Switch to TeraGSS 17.20.00.04 and OpenSSL 1.1.1lRequires macOS 10.14 Mojave or later and ends support for older versions of macOS17.10.0.14- May 18, 2022GOSQL-104 FastExport reports invalid CSV path name for first query but not subsequentGOSQL-105 Avoid driver failure when database warning length is invalid17.10.0.13- May 16, 2022GOSQL-53 browser and logmech=BROWSER connection parametersGOSQL-56 Implement Federated Authentication feature in GoSQL DriverPYDBAPI-77 Implement Federated Authentication feature in Python driver17.10.0.12- April 15, 2022GOSQL-71 TLS certificate verificationGOSQL-98 remove escape function teradata_setloglevel17.10.0.11- April 7, 2022GOSQL-82 Escape functions teradata_field_sep and teradata_field_quoteGOSQL-97 FastLoad/FastExport accommodate extra whitespace in SQL request17.10.0.10- March 24, 2022GOSQL-95 case-insensitive sslmode connection parameter valuesGOSQL-96 avoid CVE security vulnerabilities present in Go 1.17 and earlierBuild DLL and shared library with Go 1.18Requires macOS 10.13 High Sierra or later and ends support for older versions of macOS17.10.0.9- March 18, 2022GOSQL-94 thread-safe connect failure cache17.10.0.8- March 9, 2022GOSQL-84 accommodate 64-bit Activity CountGOSQL-92 FastLoad returns error 512 when first column value is NULL17.10.0.7- February 23, 2022GOSQL-91 Avoid Error 8019 by always sending Config Request message17.10.0.6- February 4, 2022GOSQL-26 provide stored procedure creation errorsGOSQL-73 Write CSV filesGOSQL-88 Append streamlined client call stack to ClientProgramName17.10.0.5- January 10, 2022GOSQL-86 provide UDF compilation errors17.10.0.4- December 13, 2021GOSQL-20 TLS supportGOSQL-29 Laddered Concurrent ConnectPYDBAPI-82 Implement Laddered Concurrent Connect in Python driver17.10.0.3- November 30, 2021GOSQL-12 Centralized administration for data encryptionGOSQL-25 Assign Response message error handlingGOSQL-27 Enhance checks for missing logon parametersGOSQL-65 improve terasso error messagesGOSQL-66 transmit Client Attributes to DBS during logonPYDBAPI-58 Centralized administration (from database) of Data EncryptionBuild DLL and shared library with Go 1.15.1517.10.0.2- July 2, 2021GOSQL-33 CALL to stored procedure INOUT and OUT parameter output valuesGOSQL-35 Statement IndependenceGOSQL-72 Read CSV filesPYDBAPI-39 JSON, CSV, and Avro data type supportPYDBAPI-83 Escape Syntax for FLOAT Data Type17.10.0.1- June 9, 2021Corrected documentation formatting for PyPI17.10.0.0- June 8, 2021GOSQL-75 trim whitespace from SQL request text17.0.0.8- December 18, 2020Documentation changes17.0.0.7- December 18, 2020GOSQL-13 add support for FastExport protocol17.0.0.6- October 9, 2020GOSQL-68 cross-process COP hostname load distribution17.0.0.5- August 26, 2020GOSQL-64 improve error checking for FastLoad escape functions17.0.0.4- August 18, 2020GOSQL-62 prevent nativesql from executing FastLoadGOSQL-63 prevent FastLoad panic17.0.0.3- July 30, 2020Build DLL and shared library with Go 1.14.617.0.0.2- June 10, 2020GOSQL-60 CLOBTranslate=Locked workaround for DBS DR 19429317.0.0.1- June 4, 2020GOSQL-61 FastLoad accommodate encryptdata true16.20.0.62- May 12, 2020GOSQL-58 support multiple files for Elicit File protocolGOSQL-59 FastLoad accommodate dbscontrol change of COUNT(*) return type16.20.0.61- Apr 30, 2020GOSQL-57 Deferred LOB values larger than 1MB16.20.0.60- Mar 27, 2020GOSQL-22 enable insert of large LOB values over 64KBGOSQL-52 teradata_try_fastload consider bind value data typesGOSQL-54 enforce Decimal value maximum precision 38PYDBAPI-37 Teradata Data Types Support up to 14.10 including LOB data16.20.0.59- Jan 8, 2020GOSQL-51 FastLoad fails when table is dropped and recreatedPYDBAPI-72 bind value performance improvementPYDBAPI-73 DBAPI fails to insert 16383 rows16.20.0.58- Dec 11, 2019PYDBAPI-71 execute and executemany ignoreErrors parameter16.20.0.57- Dec 10, 2019GOSQL-50 provide FastLoad duplicate row errors with auto-commit on16.20.0.56- Dec 4, 2019PYDBAPI-70 raise error for closed cursor usage16.20.0.55- Nov 26, 2019GOSQL-15 add database connection parameterPYDBAPI-66 Better exception when running on 32-bit Python16.20.0.54- Nov 21, 2019GOSQL-49 FastLoad support for additional connection parameters16.20.0.53- Nov 15, 2019GOSQL-36 segment and iterate parameter batches per batch row limitGOSQL-43 segment and iterate parameter batches per request message size limit for FastLoad16.20.0.52- Oct 18, 2019Sample programs for fake result sets16.20.0.51- Oct 16, 2019GOSQL-46 LDAP password special characters16.20.0.50- Oct 7, 2019PYDBAPI-68 improve performance for batch bind values16.20.0.49- Oct 3, 2019GOSQL-45 FastLoad interop with Stored Password Protection16.20.0.48- Sep 6, 2019GOSQL-14 add support for FastLoad protocolGOSQL-34 negative scale for Number valuesPYDBAPI-29 Data Transfer - FastLoad Protocol16.20.0.47- Aug 27, 2019GOSQL-40 Skip executing empty SQL request textPYDBAPI-67 teradatasql.connect JSON connection string optional16.20.0.46- Aug 16, 2019GOSQL-39 COP Discovery interop with Kerberos16.20.0.45- Aug 12, 2019GOSQL-38 timestamp prefix log messages16.20.0.44- Aug 7, 2019GOSQL-4 Support COP discoveryPYDBAPI-36 COP Discovery16.20.0.43- Jul 29, 2019GOSQL-18 Auto-commitPYDBAPI-61 commit and rollback methods16.20.0.42- Jun 7, 2019PYDBAPI-65 sample programBatchInsert.py16.20.0.41- Feb 14, 2019PYDBAPI-57 fetchmany may return "rows are closed" instead of empty result set16.20.0.40- Feb 8, 2019GOSQL-11 JWT authentication methodGOSQL-16 tmode connection parameterGOSQL-17 commit and rollback functions16.20.0.39- Oct 26, 2018GOSQL-33 CALL to stored procedure INOUT and OUT parameter output values16.20.0.38- Oct 25, 2018PYDBAPI-56 Stored Procedure Dynamic Result Sets16.20.0.37- Oct 22, 2018Documentation change16.20.0.36- Oct 22, 2018GOSQL-5 Create/Replace Procedure MultiTSR protocol16.20.0.35- Oct 22, 2018GOSQL-10 Stored Password ProtectionPYDBAPI-28 Secure Password at restPYDBAPI-47 Port sample program TJEncryptPassword to Python16.20.0.34- Oct 15, 2018Fix for sample programTJEncryptPassword.py16.20.0.33- Oct 12, 2018Installation dependency pycryptodome16.20.0.32- Sep 19, 2018Sample programsLoadCSVFile.pyandMetadataFromPrepare.pyEscape function teradata_fake_result_sets16.20.0.31- Sep 19, 2018Added function tracing16.20.0.30- Sep 14, 2018PYDBAPI-12 ConnectivityPYDBAPI-33 Pandas library InteroperabilityMoved samples directory16.20.0.29- Sep 14, 2018Sample programElicitFile.py16.20.0.28- Sep 13, 2018Documentation change16.20.0.27- Sep 12, 2018Documentation change16.20.0.26- Sep 11, 2018PYDBAPI-8 DocumentationPYDBAPI-9 User Guide Content16.20.0.25- Sep 10, 2018Documentation change16.20.0.24- Sep 6, 2018PYDBAPI-54 Implement cursor rowcount attributePYDBAPI-55 Improved support for Python data types16.20.0.23- Aug 31, 2018KeepResponse only for LOB locators16.20.0.22- Aug 30, 2018Fixed NUMBER values16.20.0.21- Aug 29, 2018Close orphaned rows16.20.0.20- Aug 28, 2018decimal and datetime values16.20.0.19- Aug 22, 2018timedelta bind values16.20.0.18- Aug 21, 2018datetime.datetime bind values16.20.0.17- Aug 20, 2018Version number in errors16.20.0.16- Aug 17, 2018SLES 11 SP1 compatibility16.20.0.15- Aug 17, 2018Documentation change16.20.0.14- Aug 10, 2018Documentation change16.20.0.13- Aug 9, 2018Documentation change16.20.0.12- Aug 9, 2018PYDBAPI-10 User Guide Delivery and ViewabilityPYDBAPI-11 Searchability16.20.0.11- Aug 8, 2018Documentation change16.20.0.10- Aug 8, 2018Documentation change16.20.0.9- Aug 7, 2018Install documentation in teradatasql directory16.20.0.8- Aug 7, 2018GOSQL-7 TDNEGO authentication methodPYDBAPI-42 Teradata Logon mechanism - TDNEGO16.20.0.7- Jul 30, 2018GOSQL-8 Support parameter marker batch insertPYDBAPI-45 Parameterized Batch Insertion using executeMany16.20.0.6- Jul 25, 2018Thread safety for handle maps16.20.0.5- Jul 25, 2018Removed atexit16.20.0.4- Jul 23, 2018PYDBAPI-4 Provide Python Driver license file16.20.0.3- Jul 19, 2018PYDBAPI-46 Accept subclasses of bytes, int, float, str as bind values16.20.0.2- Jul 19, 2018Package attributes change16.20.0.1- Jul 18, 2018Version number change16.20.0.0- Jul 18, 2018GOSQL-1 Encrypted logonGOSQL-2 LDAP and Kerberos authenticationGOSQL-3 Support for 1MB RowsGOSQL-6 Elicit File protocolPYDBAPI-1 DistributionPYDBAPI-5 cursor.execute method return cursorPYDBAPI-6 Install and DeploymentPYDBAPI-7 pip install of python driver packagePYDBAPI-13 Operating System PlatformsPYDBAPI-14 Driver must be available for use by Windows OS UsersPYDBAPI-15 Driver must be available for use by OSX (Mac) UsersPYDBAPI-16 Driver must be available for use by Linux OS UsersPYDBAPI-17 Python Language versionPYDBAPI-18 Python language version 3.4PYDBAPI-19 DistributionPYDBAPI-23 Teradata Analytics Platform Interoperability/SupportPYDBAPI-24 Works with Teradata Database 16.10, 16.20PYDBAPI-26 Teradata Logon mechanism - KerberosPYDBAPI-32 Downloadable from pypi.orgPYDBAPI-40 Teradata Logon mechanism - LDAPPYDBAPI-41 Teradata Logon mechanism - TD2PYDBAPI-43 parameterized single-row insertsPYDBAPI-44 parameterized queries