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

Use the td_remove_context function to remove an existing context created using the td_create_context or the td_set_context function. This performs removal (garbage collection) of all non-persistent work tables created by the analytic functions. This closes the corresponding connection object.
Note: If DBI::dbDisconnect is invoked on the connection object in the current context before calling the td_remove_context function, then a warning is displayed and garbage collection is not performed.

Usage

td_remove_context()

Value

Returns NULL invisibly

See Also

td_create_context td_set_context td_get_context

Examples

# Example 1: Remove the connection that is established using td_create_context().
td_create_context(dsn = "TeradataDSN")
# The nonpersistent work tables are garbage collected and the connection is disconnected
td_remove_context()

# Example 2: Remove the connection that is established using td_set_context().
# Establish connection to Teradata Vantage using the dbConnect API
con <- DBI::dbConnect(odbc::odbc(), dsn = "TeradataDSN")

# Use td_set_context to initialize a context with a given connection object.
td_set_context(con = con)
td_remove_context()