Teradata Package for R Function Reference | 17.00 - 17.00 - sql_query_save - Teradata Package for R

Teradata® Package for R Function Reference

Product
Teradata Package for R
Release Number
17.00
Release Date
July 2021
Content Type
Programming Reference
Publication ID
B700-4007-090K
Language
English (United States)

Description

This function builds a create table query to be used by db_save_query to create the table.

Usage

## S3 method for class 'Teradata'
sql_query_save(
  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.
Permitted Values: NOPI(No Primary Index), PI(Primary Index).
Default : PI
Types : character

primary.index

Optional Argument.
Specifies the name of the primary index column. 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 the query of the table that is to be created.

See Also

db_compute(), db_save_query()

Examples

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

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

sql_query <- "select * from sql_query_save_test"

# Get the SQL query for the PI table from the result set of "sql_query".
sql_query_save(con, sql_query, "db_save_query_test1", temporary = FALSE,
               table.type = "PI",
               primary.index = c("Petal.Length","Species"))