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

View source: R/00-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 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

# 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:
## Not run: 
dbWriteTable(con, Id("myschema", "mytable"), data.frame(a = 1))

## End(Not run)

DBI documentation built on June 22, 2024, 9:41 a.m.