con <- DBI::dbConnect(duckdb::duckdb(dbdir = tempfile()))
create_or_replace_share(
.con = con,
share_name = "analytics_share",
database_name = "sales_db",
access = "PUBLIC",
visibility = "LISTED",
update = "AUTOMATIC"
)Create or replace a MotherDuck database share
Source: R/api.R
Creates a new share or replaces an existing share for a specified database in MotherDuck. This allows you to update the configuration of an existing share or create a new one if it does not exist.
Usage
create_or_replace_share(
.con,
share_name,
database_name,
access = "PUBLIC",
visibility = "LISTED",
update = "AUTOMATIC"
)Arguments
-
.con -
A valid
DBIconnection (DuckDB / MotherDuck). -
Character. The name of the share to create or replace.
-
database_name -
Character. The name of the database to be shared.
-
access -
Character. Access level for the share; either
“RESTRICTED”or“PUBLIC”(default:“PUBLIC”). -
visibility -
Character. Visibility of the share; either
“HIDDEN”or“LISTED”(default:“LISTED”). -
update -
Character. Update policy for the share; either
“AUTOMATIC”or“MANUAL”(default:“AUTOMATIC”).
Value
A message indicating that the share has been created or replaced.
Details
This function executes a CREATE OR REPLACE SHARE SQL statement to create a new share or update an existing one.
-
accesscontrols who can access the share. -
visibilitycontrols whether the share is listed publicly or hidden. -
updatecontrols whether changes to the source database are automatically reflected in the share. The current user is displayed for confirmation before execution.
See Also
Other db-manage: alter_table_schema(), copy_tables_to_new_location(), create_database(), create_if_not_exists_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()