The td_to_csv() function exports data from Teradata Vantage to CSV file with or without FastExport protocol.
Example Setup
- Load the required tables into Vantage.
> loadExampleData("time_series_example", "ocean_buoys_seq")
- Create the "df_seq" object.
# 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 FastExport
> 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 with specific number of rows
> td_to_csv(df = df_seq, csv.file.name ="test.csv", num.rows = 10500, catch.errors.warnings = FALSE)