fastexport() | Teradata Package for Python - fastexport() - 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

The fastexport() function exports teradataml DataFrame to Pandas DataFrame using the FastExport data transfer protocol. FastExport opens multiple data transfer connections to the database.

Teradata recommends using fastexport() function when number of rows in the teradataml DataFrame is at least 100,000. To extract lesser rows, you can ignore this function and use regular to_pandas() function.

  • FastExport does not support all Teradata database data types.

    For example, tables with BLOB and CLOB type columns cannot be extracted.

  • FastExport cannot be used to extract data from a volatile or temporary table.
  • For best efficiency, do not use DataFrame.groupby() and DataFrame.sort() with FastExport.
The fastexport() function returns:
  • When export_to is set to 'pandas' and catch_errors_warnings is set to True, the fastexport() function returns a tuple containing:
    • Pandas DataFrame.
    • Errors, if any, thrown by fastexport in a list of strings.
    • Warnings, if any, thrown by fastexport in a list of strings.
  • When export_to is set to 'pandas' and catch_errors_warnings is set to False, the fastexport() function returns a Pandas DataFrame.

See the FastExport section of https://pypi.org/project/teradatasql/ for more information about FastExport protocol through teradatasql driver.

Example Prerequisites

>>> from teradataml import fastexport
>>> load_example_data("dataframe", "admissions_train")
>>> df = DataFrame("admissions_train")

Example 1: Export teradataml DataFrame 'df' to Pandas DataFrame

>>> fastexport(df)

Example 2: Export teradataml DataFrame 'df' to Pandas DataFrame with settings

This example exports the teradataml DataFrame 'df' to Pandas DataFrame, set index column, coerce_float and catch errors/warnings thrown by fastexport.

>>> pandas_df, err, warn = fastexport(df, index_column="gpa", coerce_float=True)
# Print pandas DataFrame.
>>> pandas_df
# Print errors list.
>>> err
# Print warnings list.
>>> warn