DataFrames Become Invalid When a Context is Recreated | Teradata Python Package - DataFrames Become Invalid When a Connection Context is Recreated - 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
December 2024
Language
English (United States)
Last Update
2025-01-23
dita:mapPath
nvi1706202040305.ditamap
dita:ditavalPath
plt1683835213376.ditaval
dita:id
rkb1531260709148
Product Category
Teradata Vantage

On recreating a connection context using the create_context command, most of the operations on the DataFrames created using an earlier connection context fail.

The users receive a warning when the create_context command is rerun.

For example:

>>> create_context(host = "myhostname", username="myusername", password = "mypassword")
>>> df = DataFrame('table1')
 
>>> create_context(host = "myhostname", username="myusername", password = "mypassword")
UserWarning: [Teradata][teradataml](TDML_2002) Overwriting an existing context associated with Teradata connection. Most of the operations on any teradataml DataFrames created before this will not work.
 
 
>>> df.select(['model','phrase_id'])
TeradataMlException: [Teradata][teradataml](TDML_2103) Internal Error: Non-zero status returned from AED.

To work around this limitation, recreate the DataFrames with the new connection context.

For example, recreate the 'df' DataFrame after the new connection context is created in the previous example.

>>> df = DataFrame('table1')
>>> df.select(['model','phrase_id'])
      phrase_id
model         
1             1
1             2
1             2
1             1
1             1
1             1
(6, 3)