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 ...`. If connected to MotherDuck, the target database is created if missing, and the target schema is created if missing on any 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_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.