Copies one or more tables to a new location (database/schema) by creating
new tables via CREATE TABLE ... AS SELECT * FROM ....
Requires motherduck connection
copy_tables_to_new_location(
.con,
from_table_names,
to_database_name,
to_schema_name
)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.
A valid DBI connection (DuckDB / MotherDuck).
A tibble/data frame listing source tables, with
columns database_name, schema_name, and table_name.
Target database name.
Target schema name.
Input from_table_names must contain columns:
database_name, schema_name, and table_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.
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()