tdCreate: tdCreate

Description Usage Arguments Details Value See Also

Description

Creates a table in Teradata and (optionally) uploads data. Can take a JDBC connection object (conn) if provided. If no JDBC connection is provided, then a connection is attempted using the user, and password provided. If none is provided, then tries to locate a connection object (conn) in the global environment.

If a connection profile (e.g. username, password, etc.) is provided, then an attempt is made to connect to Teradata. Once the query is run, the connection is then closed. If a connection object (conn) is provided to the function (or one is found globally), then the connection remains open.

Usage

1
2
3
tdCreate(data = NULL, table = NULL, upload = TRUE, colType = NULL,
  pi = NULL, batchSize = 2500, deleteIfExists = FALSE, verbose = TRUE,
  ...)

Arguments

data

link{data.frame} containing data to upload. This must be in the same column order as the Teradata table.

table

Name of the Teradata table to upload data to. If NULL, then the name of the data.frame provided will be used as the Teradata table name, with periods replaced by underscores.

upload

logical. If TRUE, then the function will call tdUpload to upload the data after creating the table.

colType

Vector of column types for Teradata table. If NULL, will be inferred following approach listed in details section.

pi

Primary index for Teradata table. If NULL, will take the first column with all unique values as the primary index. If none exists, will take the first column in data.

batchSize

Number of rows to upload simultaneously. Only used if upload=TRUE.

deleteIfExists

If TRUE, then check for table and deletes if one exists.

verbose

logical. If TRUE, then print message after each batch is uploaded.

...

Optional connection settings.

Details

If not provided, the columns will be defined according to the class of each column in the provided data.frame.

In order to keep the required Java memory down, data is uploaded in batches at a time. This can be configured to be as many (or little observations) as desired. If any of the batched observations have bad values, then all observations corresponding with that batch will fail to load. It might help in this situation to reduce the batch size to pinpoint which observation(s) is(are) causing the issue.

Value

Returns an invisible objecting containing the count of the number of rows uploaded.

See Also

tdConn for connection, tdUpload for table upload, td for general queries, tdCpu for CPU usage.


tranlm/tdR documentation built on May 31, 2019, 7:45 p.m.