Creates a new database on MotherDuck (if it does not exist) and copies
all objects from an existing local database into it using the
`COPY FROM DATABASE` command.
Usage
upload_database_to_md(.con, from_db_name, to_db_name)
Arguments
- .con
A valid MotherDuck `DBI` connection.
- from_db_name
The local database name to copy from.
- to_db_name
The target MotherDuck database to create/overwrite.
Value
Invisibly returns `NULL`.
Side effect: creates the target database and copies all objects; prints a CLI
action report.
Details
- Runs `CREATE DATABASE <to_db_name>` if the target database does not exist.
- Then runs `COPY FROM DATABASE <from_db_name> TO <to_db_name>` to copy all
objects (tables, views, etc.) from the local database.
- Prints a CLI status report (connection, user, current DB) after completion.
Examples
if (FALSE) { # \dontrun{
con <- DBI::dbConnect(duckdb::duckdb())
upload_database_to_md(con, from_db_name = "local_db", to_db_name = "analytics")
} # }