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

Teradata® Package for Python User Guide

Deployment
VantageCloud
VantageCore
Edition
VMware
Enterprise
IntelliFlex
Product
Teradata Package for Python
Release Number
20.00
Publication Date
March 2025
Content Type
User Guide
Publication ID
B700-4006-200K
ft:locale
en-US
ft:lastEdition
2026-08-13
dita:mapPath
nvi1706202040305.ditamap
dita:ditavalPath
plt1683835213376.ditaval
ft:sourceId
dita
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.