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

Teradata® Package for R Function Reference

Product
Teradata Package for R
Release Number
17.00
Published
July 2021
Language
English (United States)
Last Update
2023-08-08
dita:id
B700-4007
NMT
no
Product Category
Teradata Vantage
Creates a Table

Description

This function 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.
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 name of newly created remote table. Also, prints the query when the option "td.debug.enable" is enabled.

See Also

db_compute, sql_query_save

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