Teradata R Package Function Reference - db_compute - Teradata R Package - Look here for syntax, methods and examples for the functions included in the Teradata R Package.

Teradata® R Package Function Reference

Product
Teradata R Package
Release Number
16.20
Published
February 2020
Language
English (United States)
Last Update
2020-02-28
dita:id
B700-4007
lifecycle
previous
Product Category
Teradata Vantage

Description

Creates a table from query.

Usage

## S3 method for class 'Teradata'
db_compute(
  con,
  table,
  sql,
  temporary = FALSE,
  table.type = "PI",
  primary.index = NULL,
  ...
)

Arguments

con

Required Argument.
Specifies remote data source.

table

Required Argument.
Specifies name of the new remote table.
Types : character

sql

Required Argument.
Specifies a query from which new table is to be created.
Types : sql OR character

temporary

Optional Argument.
Specifies whether to create a temporary remote table(TRUE) or not(FALSE).
Default : FALSE
Types : logical

table.type

Optional Argument.
Specifies type of remote table - NOPI(No Primary Index), PI(Primary Index).
Default : PI
Types : character

primary.index

Optional Argument.
Specifies name of the primary index column. You can provide multiple columns as a vector. When primary.index is not specified and table.type is "PI", the behavior is specified by the "PrimaryIndexDefault" field in DBS Control.
Default : NULL
Types : character OR vector of characters

...

Other parameters passed to methods.

Value

Returns name of the newly created remote table.

See Also

db_save_query()

Examples

# Get remote data source connection.
con <- td_get_context()$connection

# Save iris dataset into table 'db_compute_test'.
iris2 <-  copy_to(con, iris, name = "db_compute_test", overwrite = FALSE)

sql <- "select * from db_compute_test"

# Create PI table from the result set of "sql".
db_compute(con, "db_compute_test1", sql, temporary = FALSE, table.type = "PI",
           primary.index = c("Petal.Length","Species"))