attach_attributes() | Teradata Package for R - attach_attributes() - Teradata Package for R

Teradata® Package for R User Guide

Product
Teradata Package for R
Release Number
17.00
Published
July 2021
Language
English (United States)
Last Update
2023-08-08
dita:mapPath
yih1585763700215.ditamap
dita:ditavalPath
ayr1485454803741.ditaval
dita:id
B700-4005
Product Category
Teradata Vantage
The attach_attributes() 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, that is, table name or sql query.
  • sourceType - Type of input source, that is, 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.

The tbl_teradata object name is a required argument of this function.

Example Setup

  • Get remote data source connection.
    con <- td_get_context()$connection
  • Load the required tables.
    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'

attach_attributes(tbl_antiselect)
Retrieve the attributes using the attributes() function.:
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 the attributes() function.:
antiselect_attr <- attributes(tbl_antiselect_wo_metadata)