pub trait CatalogProvider: Sync + Send {
    // Required methods
    fn as_any(&self) -> &dyn Any;
    fn schema_names(&self) -> Vec<String>;
    fn schema(&self, name: &str) -> Option<Arc<dyn SchemaProvider>>;

    // Provided methods
    fn register_schema(
        &self,
        name: &str,
        schema: Arc<dyn SchemaProvider>
    ) -> Result<Option<Arc<dyn SchemaProvider>>> { ... }
    fn deregister_schema(
        &self,
        _name: &str,
        _cascade: bool
    ) -> Result<Option<Arc<dyn SchemaProvider>>> { ... }
}
Expand description

Represents a catalog, comprising a number of named schemas.

Required Methods§

source

fn as_any(&self) -> &dyn Any

Returns the catalog provider as Any so that it can be downcast to a specific implementation.

source

fn schema_names(&self) -> Vec<String>

Retrieves the list of available schema names in this catalog.

source

fn schema(&self, name: &str) -> Option<Arc<dyn SchemaProvider>>

Retrieves a specific schema from the catalog by name, provided it exists.

Provided Methods§

source

fn register_schema( &self, name: &str, schema: Arc<dyn SchemaProvider> ) -> Result<Option<Arc<dyn SchemaProvider>>>

Adds a new schema to this catalog.

If a schema of the same name existed before, it is replaced in the catalog and returned.

By default returns a “Not Implemented” error

source

fn deregister_schema( &self, _name: &str, _cascade: bool ) -> Result<Option<Arc<dyn SchemaProvider>>>

Removes a schema from this catalog. Implementations of this method should return errors if the schema exists but cannot be dropped. For example, in DataFusion’s default in-memory catalog, MemoryCatalogProvider, a non-empty schema will only be successfully dropped when cascade is true. This is equivalent to how DROP SCHEMA works in PostgreSQL.

Implementations of this method should return None if schema with name does not exist.

By default returns a “Not Implemented” error

Implementors§