Moves one or more tables from an existing schema to a new (target) schema
using ALTER TABLE ... SET SCHEMA. If the target schema does not exist,
it is created first.
alter_table_schema(.con, from_table_names, new_schema)Invisibly returns a character vector of fully-qualified table names moved.
Side effects: creates new_schema if needed and alters table schemas.
A valid DBI connection (DuckDB / MotherDuck).
Character vector of table names to move.
Target schema name (where the tables will be moved).
Ensures new_schema exists (CREATE SCHEMA IF NOT EXISTS).
For each table in table_names, runs:
ALTER TABLE old_schema.table SET SCHEMA new_schema.
Table and schema identifiers are safely quoted with glue::glue_sql().
Other db-manage:
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(),
upload_database_to_md()