Learn R Programming

DBI (version 1.2.2)

Id-class: Refer to a table nested in a hierarchy (e.g. within a schema)

Description

Objects of class Id have a single slot name, which is a character vector. The dbQuoteIdentifier() method converts Id objects to strings. Support for Id objects depends on the database backend.

They can be used in the following methods as name or table argument:

  • dbCreateTable()

  • dbAppendTable()

  • dbReadTable()

  • dbWriteTable()

  • dbExistsTable()

  • dbRemoveTable()

Objects of this class are also returned from dbListObjects().

Usage

Id(...)

Arguments

...

Components of the hierarchy, e.g. cluster, catalog, schema, or table, depending on the database backend. For more on these concepts, see https://stackoverflow.com/questions/7022755/

Examples

Run this code
# Identifies a table in a specific schema:
Id("dbo", "Customer")
# You can name the components if you want, but it's not needed
Id(table = "Customer", schema = "dbo")

# Create a SQL expression for an identifier:
dbQuoteIdentifier(ANSI(), Id("nycflights13", "flights"))

# Write a table in a specific schema:
if (FALSE) {
dbWriteTable(con, Id("myschema", "mytable"), data.frame(a = 1))
}

Run the code above in your browser using DataLab