Description
The td_to_csv
function exports data from Teradata Vantage to CSV file
with or without FastExport protocol.
Usage
td_to_csv(
df,
csv.file.name,
use.fastexport = NA,
num.rows = 9999,
all.rows = FALSE,
catch.errors.warnings = TRUE,
...
)
Arguments
df |
Required Argument. |
csv.file.name |
Required Argument. |
use.fastexport |
Optional Argument.
For additional information about fastexport protocol through teradatasql
driver, please refer the FastExport section of
terdatasql driver documentation. |
num.rows |
Optional Argument.
Default Value: 99999 |
all.rows |
Optional Argument. |
catch.errors.warnings |
Optional Argument. |
... |
Optional Argument. |
Value
Function returns a named list containing the following objects:
errors (only if "catch.errors.warnings" is set to TRUE):
If there are no errors, this contains NULL.
If there are errors, this contains a R dataframe containing the errors.
warnings (only if "catch.errors.warnings" is set to TRUE):
If there are no warnings, this contains NULL.
If there are errors, this contains a R dataframe containing the warnings.
Named list member can be referenced directly with the "$" operator.
See Also
td_fastload
td_fastexport
Examples
# Note: Connection must be established before running td_to_csv().
# 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: Export the data in a csv file along with the errors and warnings, if any,
# while extracting the data.
val <- td_to_csv(df = df1,
csv.file.name = 'test.csv')
# Example 2: Export the data without errors and warnings.
val <- td_to_csv(df = df1,
csv.file.name = 'test.csv',
catch.errors.warnings = FALSE)
# Example 3: Export the data in a csv file, with all.rows set to TRUE and
# catch errors and warnings, if any.
val <- td_to_csv(df = df1,
csv.file.name = 'test.csv',
all.rows = TRUE,
catch.errors.warnings = TRUE)
# Example 4: Export the data in a csv file using the specified
# field.quote.char and field.separator.
td_to_csv(df = df_seq,
csv.file.name ="test.csv",
field.separator=";",
field.quote.char="'",
catch.errors.warnings = FALSE)
# Example 5: Export the data in a csv file using use.fastexport = TRUE.
td_to_csv(df = df_seq,
csv.file.name ="test.csv",
use.fastexport=TRUE,
open.sessions = 4,
catch.errors.warnings = FALSE)
# Example 6: Export the data in a csv file using num.rows = 10500.
td_to_csv(df = df_seq,
csv.file.name ="test.csv",
num.rows = 10500,
catch.errors.warnings = FALSE)