Teradata R Package Function Reference | 17.00 - 17.00 - db_save_query - 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

Builds and executes a create table query.

Usage

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

Arguments

con

Required Argument.
Specifies remote data source.

sql

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

name

Required Argument.
Specifies name of the new remote table.
Types : 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 newly created remote table.

See Also

db_compute()

Examples

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

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

sql <- "select * from db_save_query_test"

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