Teradata R Package Function Reference | 17.00 - 17.00 - db_compute - Teradata R Package

Teradata® R Package Function Reference

prodname
Teradata R Package
vrm_release
17.00
created_date
September 2020
category
Programming Reference
featnum
B700-4007-090K

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"))