DataFrames Become Invalid When a Context is Recreated | Teradata Python Package - 17.00 - DataFrames Become Invalid When a Connection Context is Recreated - Teradata Package for Python

Teradata® Package for Python User Guide

Product
Teradata Package for Python
Release Number
17.00
Release Date
November 2021
Content Type
User Guide
Publication ID
B700-4006-070K
Language
English (United States)

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 above 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)