dm_sql {dm}R Documentation

Create DDL and DML scripts for a dm a and database connection

Description

[Experimental]

Generate 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.

Usage

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)

Arguments

dm

A dm object.

dest

Connection to database.

table_names

A named character vector or named vector of DBI::Id, DBI::SQL or dbplyr objects created with dbplyr::ident(), dbplyr::in_schema() or dbplyr::in_catalog(), with one unique element for each table in dm. The default, NULL, means to use the original table names.

temporary

Should the tables be marked as temporary? Defaults to TRUE.

Details

Value

Nested list of SQL statements.

Examples


con <- DBI::dbConnect(RSQLite::SQLite())
dm <- dm_nycflights13()
s <- dm_sql(dm, con)
s
DBI::dbDisconnect(con)


[Package dm version 1.0.10 Index]