Ensures that a specified schema exists in the given database. If the connection is to a MotherDuck instance, the function switches to the specified database before creating the schema. It also prints helpful connection and environment information via CLI messages for transparency.
create_schema(.con, database_name, schema_name)Invisibly returns NULL.
Side effect: creates the schema if necessary and prints CLI messages.
A valid DBI connection (DuckDB / MotherDuck).
Name of the database to create/use.
Name of the schema to create if it does not exist.
Uses DBI::dbExecute() with CREATE SCHEMA IF NOT EXISTS to create
the schema only when needed.
If connected to MotherDuck (determined by
validate_md_connection_status()), executes USE <database> before
creating the schema.
Displays connection/user/database information via internal CLI helpers.
Other db-manage:
alter_table_schema(),
copy_tables_to_new_location(),
create_database(),
create_if_not_exists_share(),
create_or_replace_share(),
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()