Upload a Local Database to MotherDuck
upload_database_to_md.RdCreates 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.
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.
See also
Other db-manage:
alter_table_schema(),
copy_tables_to_new_location(),
create_database(),
create_if_not_exists_share(),
create_or_replace_share(),
create_schema(),
create_table(),
delete_and_create_schema(),
delete_database(),
delete_schema(),
delete_table(),
describe_share(),
drop_share(),
list_owned_shares(),
list_shared_with_me_shares()
Examples
if (FALSE) { # \dontrun{
con_db <- DBI::dbConnect(duckdb::duckdb())
create_table(.con=con_db,.data=mtcars,database_name="memory",schema_name="main",table_name="mtcars")
con_md <- connect_to_motherduck()
upload_database_to_md(con_md, from_db_name = "memory", to_db_name = "analytics")
} # }