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.
By default, temporary tables will be created and the key constraints will be set
(currently only on MSSQL and Postgres databases).
copy_dm_to( dest, dm, ..., types = NULL, overwrite = NULL, indexes = NULL, unique_indexes = NULL, set_key_constraints = TRUE, unique_table_names = NULL, table_names = NULL, temporary = TRUE )
dest | An object of class |
---|---|
dm | A |
... | Passed on to |
overwrite, types, indexes, unique_indexes | Must remain |
set_key_constraints | Boolean variable, if |
unique_table_names | Deprecated. |
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 | Boolean variable, if |
A dm
object on the given src
with the same table names
as the input dm
.
No tables will be overwritten; passing overwrite = TRUE
to the function will give an error.
Types are determined separately for each table, setting the types
argument will
also throw an error.
The arguments are included in the signature to avoid passing them via the
...
ellipsis.
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)#> <IDENT> `flights_planes`