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

View source: R/Id.R

Id-classR Documentation

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 named 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. schema, table, or cluster, catalog, schema, table, depending on the database backend. For more on these concepts, see https://stackoverflow.com/questions/7022755/

Examples

# Identifies a table in a specific schema:
Id(schema = "dbo", table = "Customer")

# Identifies a table in a specific cluster, catalog, and schema:
Id(cluster = "mycluster", catalog = "mycatalog", schema = "myschema", table = "mytable")

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

# Write a table in a specific schema:
## Not run: 
dbWriteTable(con, Id(schema = "myschema", table = "mytable"), data.frame(a = 1))

## End(Not run)

DBI documentation built on June 18, 2022, 9:06 a.m.