copy_dm_to | R Documentation |
copy_dm_to()
takes a dplyr::src_dbi object or a DBI::DBIConnection
object as its first argument
and a dm
object as its second argument.
The latter is copied to the former.
The default is to create temporary tables, set temporary = FALSE
to create permanent tables.
Unless set_key_constraints
is FALSE
, primary key constraints are set on all databases,
and in addition foreign key constraints are set on MSSQL and Postgres databases.
copy_dm_to(
dest,
dm,
...,
set_key_constraints = TRUE,
table_names = NULL,
temporary = TRUE,
schema = NULL,
progress = NA,
unique_table_names = NULL,
copy_to = NULL
)
dest |
An object of class |
dm |
A |
... |
These dots are for future extensions and must be empty. |
set_key_constraints |
If |
table_names |
Desired names for the tables on If left
If a function or one-sided formula, Use a variant of
If a named character vector,
the names of this vector need to correspond to the table names in the Use qualified names corresponding to your database's syntax to specify e.g. database and schema for your tables. |
temporary |
If |
schema |
Name of schema to copy the Not all DBMS are supported. |
progress |
Whether to display a progress bar, if |
unique_table_names , copy_to |
Must be |
A dm
object on the given src
with the same table names
as the input dm
.
con <- DBI::dbConnect(RSQLite::SQLite())
# Copy to temporary tables, unique table names by default:
temp_dm <- copy_dm_to(
con,
dm_nycflights13(),
set_key_constraints = FALSE
)
# Persist, explicitly specify table names:
persistent_dm <- copy_dm_to(
con,
dm_nycflights13(),
temporary = FALSE,
table_names = ~ paste0("flights_", .x)
)
dbplyr::remote_name(persistent_dm$planes)
DBI::dbDisconnect(con)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.