Attach attributes to the tbl object.
Description
This function takes an existing tbl_teradata object and attaches the following attributes:
databaseName - The name of the database in which the table exists.
sourceDefinition - Name of the source of input i.e table name or sql query.
sourceType - Type of input source i.e table or query.
object - Full name of the table when source type is table, else NULL.
baseQuery - Base Query for the tbl.
columnDataType - DataTypes of the columns.
columnNames - Names of the columns.
Usage
attach_attributes(tblObj)
Arguments
tblObj |
Required Argument. |
Value
A 'tbl_teradata' object with the attributes attached.
Examples
# Get remote data source connection.
con <- td_get_context()$connection
# Load example data.
loadExampleData("antiselect_example", "antiselect_input")
# Create objects of class "tbl_teradata" with and without metadata.
tbl_antiselect <- tbl(con, "antiselect_input")
tbl_antiselect_wo_metadata <- tbl(con, "antiselect_input", ignore.metadata=T)
# Example 1: Attach the attributes to the 'tbl_antiselect' and retrieve them.
attach_attributes(tbl_antiselect)
# Retrieve the attributes using attributes()
antiselect_attr <- attributes(tbl_antiselect)
# Example 2: Attach the attributes to the 'tbl_antiselect_wo_metadata'.
attach_attributes(tbl_antiselect_wo_metadata)
# Retrieve the attributes using attributes()
antiselect_attr <- attributes(tbl_antiselect_wo_metadata)