td: td

Description Usage Arguments Details Value See Also Examples

Description

Sends queries to Teradata. 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
td(query = "", ...)

Arguments

query

Query string to send to Teradata.

...

Optional connection settings.

Details

Uses the v15.10.00.33 release (12 Jan 2016) tdgssconfig.jar and terajdbc4.jar drivers.

A hidden option allows the user to print the SQL code being generated directly to the console without submitting the query to Teradata. Simply specify .tdCat=TRUE in the global environment before running the code.

Value

If no data is returned from query, then an invisible object is returned. Otherwise, a data.frame object with all data queried will be returned.

See Also

tdConn for connection, tdDisk for disk usage, tdSpool for spool usage, tdCpu for CPU usage, and tdJoin for joining tables.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## NOT RUN ##
## Runs a quick query based on connection profile
# td("select count(*) from ICDB_PERSON", username=<username>, password=<password>, db="GCA")

## Runs query using a separately established connection
# conn = tdConn(<username>, <password>, db="GCA")
# td("select count(*) from ICDB_PERSON", conn=conn)

## Uses same connection, but allows code to find globally
# td("select count(*) from ICDB_PERSON")

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