Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

in_schema

Refer to a table in a schema


Description

Refer to a table in a schema

Usage

in_schema(schema, table)

Arguments

schema, table

Names of schema and table. These will be automatically quoted; use sql() to pass a raw name that won't get quoted.

Examples

in_schema("my_schema", "my_table")
# eliminate quotes
in_schema(sql("my_schema"), sql("my_table"))

# Example using schemas with SQLite
con <- DBI::dbConnect(RSQLite::SQLite(), ":memory:")

# Add auxilary schema
tmp <- tempfile()
DBI::dbExecute(con, paste0("ATTACH '", tmp, "' AS aux"))

library(dplyr, warn.conflicts = FALSE)
copy_to(con, iris, "df", temporary = FALSE)
copy_to(con, mtcars, in_schema("aux", "df"), temporary = FALSE)

con %>% tbl("df")
con %>% tbl(in_schema("aux", "df"))

dbplyr

A 'dplyr' Back End for Databases

v2.1.1
MIT + file LICENSE
Authors
Hadley Wickham [aut, cre], Maximilian Girlich [aut], Edgar Ruiz [aut], RStudio [cph, fnd]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.