Check if a Schema Exists in a Database

Source: R/utils-db.R

Checks whether a schema with the specified name exists within a given database.

Usage

validate_database_schema_exists(.con, database_name, target_schema)

Arguments

.con

A valid DBI connection (DuckDB / MotherDuck).

database_name

The database name to check.

target_schema

The schema name to check within the database.

Value

Logical TRUE if the schema exists, FALSE otherwise.

Details

This function queries the information schema to check if the specified schema exists within the given database.

Examples

con <- DBI::dbConnect(duckdb::duckdb())
validate_database_schema_exists(con, "memory", "main")