| dm_sql | R Documentation |
dm a and database connectionGenerate SQL scripts to create tables, load data and set constraints, keys and indices.
This function powers copy_dm_to() and is useful if you need more control
over the process of copying a dm to a database.
dm_sql(dm, dest, table_names = NULL, temporary = TRUE)
dm_ddl_pre(dm, dest, table_names = NULL, temporary = TRUE)
dm_dml_load(dm, dest, table_names = NULL, temporary = TRUE)
dm_ddl_post(dm, dest, table_names = NULL, temporary = TRUE)
dm |
A |
dest |
Connection to database. |
table_names |
A named character vector or named vector of DBI::Id,
DBI::SQL or dbplyr objects created with |
temporary |
Should the tables be marked as temporary? Defaults to |
dm_ddl_pre() generates CREATE TABLE statements (including PRIMARY KEY definition).
dm_dml_load() generates INSERT INTO statements.
dm_ddl_post() generates scripts for FOREIGN KEY, UNIQUE KEY and INDEX.
dm_sql() calls all three above and returns a complete set of scripts.
Nested list of SQL statements.
con <- DBI::dbConnect(RSQLite::SQLite())
dm <- dm_nycflights13()
s <- dm_sql(dm, con)
s
DBI::dbDisconnect(con)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.