Use the df_type property to return a type of DataFrame based on the underlying database object.
Possible teradataml DataFrame types are:
- VALID_TIME_VIEW: DataFrame is created on Valid-Time dimension view.
- TRANSACTION_TIME_VIEW: DataFrame is created on Transaction-Time dimension view.
- BI_TEMPORAL_VIEW: DataFrame is created on Bi-temporal view.
- VALID_TIME: DataFrame is created on Valid-Time dimension table.
- TRANSACTION_TIME: DataFrame is created on Transaction-Time dimension table.
- BI_TEMPORAL: DataFrame is created on Bi-temporal dimension table.
- VIEW: DataFrame is created on a view.
- TABLE: DataFrame is created on a table.
- OTF: DataFrame is created on an OTF table.
- ART: DataFrame is created on an ART table.
- VOLATILE_TABLE: DataFrame is created on a volatile table.
- BI_TEMPORAL_VOLATILE_TABLE: DataFrame is created on a Bi-temporal dimension volatile table.
- VALID_TIME_VOLATILE_TABLE: DataFrame is created on a Valid-Time dimension volatile table.
- TRANSACTION_TIME_VOLATILE_TABLE: DataFrame is created on a Transaction-Time dimension volatile table.
Example setup
Load the data.
>>> load_example_data("teradataml", "Employee_roles") # load valid time data.
>>> load_example_data("teradataml", "Employee_Address") # load transaction time data.
>>> load_example_data("teradataml", "Employee") # load bitemporal data.
>>> load_example_data("uaf", ["ocean_buoys2"]) # load data to create art table.
>>> load_example_data('dataframe', ['admissions_train']) # load data to create a regular table.
Example 1: DataFrame created on a Valid-Time dimension table
>>> df = DataFrame.from_table('Employee_roles')
>>> df.df_type
'VALID_TIME'
Example 2: DataFrame created on a Transaction-Time dimension table
>>> df = DataFrame.from_table('Employee_Address')
>>> df.df_type
'TRANSACTION_TIME'
Example 3: DataFrame created on a bi-temporal dimension table
>>> df = DataFrame.from_table('Employee')
>>> df.df_type
'BI_TEMPORAL'
Example 4: DataFrame created on an ART table
>>> data = DataFrame.from_table('ocean_buoys2')
>>> from teradataml import TDSeries,SInfo
>>> data_series_df = TDSeries(data=data,
... id=["ocean_name","buoyid"],
... row_index="TD_TIMECODE",
... row_index_style="TIMECODE",
... payload_field="jsoncol.Measure.salinity",
... payload_content="REAL")
>>> uaf_out = SInfo(data=data_series_df, output_table_name='TSINFO_RESULTS')
>>> df = DataFrame.from_table('TSINFO_RESULTS')
>>> df.df_type
'ART'
Example 5: DataFrame created on a regular table
>>> df = DataFrame.from_table('admissions_train')
>>> df.df_type
'REGULAR_TABLE'
Example 6: DataFrame created on a volatile table
>>> df = DataFrame.from_table('admissions_train')
>>> df.to_sql(table_name='admissions_train_volatile', temporary=True)
>>> df = DataFrame.from_table('admissions_train_volatile')
>>> df.df_type
'VOLATILE_TABLE'
Example 7: DataFrame created on a Bi-temporal dimension view
>>> execute_sql('create view Employee_view AS SEQUENCED VALIDTIME AND SEQUENCED TRANSACTIONTIME select * from Employee')
>>> df = DataFrame.from_table('Employee_view')
>>> df.df_type
'BI_TEMPORAL_VIEW'