SQLAlchemy Compatibility Considerations | teradataml - SQLAlchemy Compatibility Considerations - Teradata Package for Python

Teradata® Package for Python User Guide

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Teradata Package for Python
Release Number
20.00
Published
March 2024
Language
English (United States)
Last Update
2024-04-09
dita:mapPath
nvi1706202040305.ditamap
dita:ditavalPath
plt1683835213376.ditaval
dita:id
rkb1531260709148
Product Category
Teradata Vantage
If SQLAlchemy version is 2.0.x and later, there are changes when using execute() method on objects returned by create_context(), get_context() and get_connection() APIs of teradataml:
  • Changes in execute() method of Engine object returned by create_context() and get_context() APIs of teradataml:

    execute() method of Engine object, returned by create_context() and get_context() APIs of teradataml, is not supported.

  • Changes in execute() method of Connection objects returned by get_connection() API of teradataml:

    execute() method of Connection object, returned by get_connection() API of teradataml, only accepts executable SQL statements and doesn't support string SQL statements.

Teradata recommends using execute_sql() function provided by teradataml version 17.20.00.04 and later.

teradataml 17.20.00.03 and earlier teradataml 17.20.00.04 and later
create_context(<parameters>).execute(<sql_query>) create_context(<parameters>)
Required only once.

execute_sql(<sql_query>)

get_context().execute(<sql_query>) execute_sql(<sql_query>)
Assumption is that connection is already established with Vantage database.
get_connection().execute(<sql_query>) execute_sql(<sql_query>)
Assumption is that connection is already established with Vantage database.