Copy Tables to a New Database/Schema
copy_tables_to_new_location.RdCopies one or more tables to a new location (database/schema) by creating
new tables via CREATE TABLE ... AS SELECT * FROM ....
Requires motherduck connection
Value
Invisibly returns a character vector of fully-qualified destination table names that were created. Side effect: creates target DB/schema if needed and writes new tables.
Details
Input
from_table_namesmust contain columns:database_name,schema_name, andtable_name.For each source table, the function issues:
CREATE TABLE <to_db>.<to_schema>.<table> AS SELECT * FROM <src_db>.<src_schema>.<table>.On local DuckDB (non-MotherDuck), the target database name is ignored and defaults to the current database of the connection.
See also
Other db-manage:
alter_table_schema(),
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(),
upload_database_to_md()