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

Product
Teradata Package for Python
Release Number
17.00
Published
November 2021
Language
English (United States)
Last Update
2022-01-14
dita:mapPath
bol1585763678431.ditamap
dita:ditavalPath
ayr1485454803741.ditaval
dita:id
B700-4006
lifecycle
previous
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 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)