Teradata Package for R Function Reference | 17.00 - 17.00 - td_fastexport - Teradata Package for R

Teradata® Package for R Function Reference

Product
Teradata Package for R
Release Number
17.00
Release Date
July 2021
Content Type
Programming Reference
Publication ID
B700-4007-090K
Language
English (United States)

Description

The td_fastexport function extracts data from Teradata Vantage using FastExport protocol.

Usage Notes:

  1. The function cannot be used to extract data from a volatile or global temporary table.

  2. Do not use the function to fetch only a few rows, because it opens extra connections to the database, which is time consuming.

  3. Only use this function to fetch many rows (at least 100,000 rows) so that the row-fetching performance gain exceeds the overhead of opening additional connections.

  4. The function does not support all Teradata Database data types. For example, BLOB and CLOB are not supported.

  5. For best results, do not use group_by or arrange with td_fastexport function.

  6. The result set ordering behavior with td_fastexport may differ from the ordering without td_fastexport. In particular, an object of class "tbl_teradata" containing an ordered analytic function may not produce an ordered result set. Use arrange to guarantee result set order.


For additional information about fastexport protocol through teradatasql driver, please refer the FastExport section of terdatasql driver documentation.

Usage

td_fastexport(df, catch.errors.warnings = TRUE, ...)

Arguments

df

Required Argument.
Specifies the tbl_teradata containing the data to be extracted.
Types: tbl_teradata

catch.errors.warnings

Optional Argument.
Specifies whether to catch errors and warnings (if any) raised by fastexport protocol while converting tbl_teradata to R dataframe.
Default Value: TRUE
Types: logical

...

Specifies additional arguments required for future enhancements.

Value

Function returns an object of class "FastExport" which is a named list containing the following objects:

  1. result : A R dataframe containing the data.

  2. errors (only if "catch.errors.warnings" is set to TRUE):

    1. If there are no errors, this contains NULL.

    2. If there are errors, this contains a R dataframe containing the errors raised by fastexport protocol.

  3. warnings (only if "catch.errors.warnings" is set to TRUE):

    1. If there are no warnings, this contains NULL.

    2. If there are errors, this contains a R dataframe containing the warnings raised by fastexport protocol.

Named list member can be referenced directly with the "$" operator.

See Also

td_fastload

Examples

# Note: Connection must be established before running td_fastexport().

# Load the required tables.
loadExampleData("time_series_example", "ocean_buoys_seq")

# Create object(s) of class "tbl_teradata".
df_seq <- tbl(con, "ocean_buoys_seq")

# Example 1: Extract the data along with the errors and warnings, if any,
#            while fetching the data.
val <- td_fastexport(df = df_seq)

# Print 10 rows of the fetched dataframe.
head(val$result, 10)

# Print the errors dataframe; NULL if there are no errors.
val$errors

# Print the warnings dataframe; NULL if there are no warnings.
val$warnings

# Example 2: Extract the data without errors and warnings.
val <- td_fastexport(df = df_seq, catch.errors.warnings = FALSE)

# Print the "FastExport" object.
print(val)