unitycatalog_server/codegen/schemas/handler.rs
1// @generated — do not edit by hand.
2//! Handler trait for [`SchemaHandler`].
3//!
4//! Implement this trait to provide a custom backend for this service, then mount the
5//! generated handler functions (in the sibling `server` module) onto an `axum::Router`
6//! with your implementation as state.
7//!
8//! # Composability
9//!
10//! A single struct can implement multiple handler traits to serve multiple
11//! services. Use [`axum::Router::merge`] to compose per-service routers together.
12//!
13//! A schema (also called a database) is the second layer of Unity Catalog’s three-level namespace.
14//! A schema organizes tables, views and functions. To access (or list) a table or view in a schema,
15//! users must have the USE_SCHEMA data permission on the schema and its parent catalog, and they must
16//! have the SELECT permission on the table or view.
17use crate::Result;
18use async_trait::async_trait;
19use unitycatalog_common::models::schemas::v1::*;
20#[async_trait]
21pub trait SchemaHandler<Cx = crate::api::RequestContext>: Send + Sync + 'static {
22 /// Gets an array of schemas for a catalog in the metastore. If the caller is the metastore
23 /// admin or the owner of the parent catalog, all schemas for the catalog will be retrieved.
24 /// Otherwise, only schemas owned by the caller (or for which the caller has the USE_SCHEMA privilege)
25 /// will be retrieved. There is no guarantee of a specific ordering of the elements in the array.
26 async fn list_schemas(
27 &self,
28 request: ListSchemasRequest,
29 context: Cx,
30 ) -> Result<ListSchemasResponse>;
31 /// Creates a new schema for catalog in the Metatastore. The caller must be a metastore admin,
32 /// or have the CREATE_SCHEMA privilege in the parent catalog.
33 async fn create_schema(&self, request: CreateSchemaRequest, context: Cx) -> Result<Schema>;
34 /// Gets the specified schema within the metastore.
35 /// The caller must be a metastore admin, the owner of the schema,
36 /// or a user that has the USE_SCHEMA privilege on the schema.
37 async fn get_schema(&self, request: GetSchemaRequest, context: Cx) -> Result<Schema>;
38 /// Updates a schema for a catalog. The caller must be the owner of the schema or a metastore admin.
39 /// If the caller is a metastore admin, only the owner field can be changed in the update.
40 /// If the name field must be updated, the caller must be a metastore admin or have the CREATE_SCHEMA
41 /// privilege on the parent catalog.
42 async fn update_schema(&self, request: UpdateSchemaRequest, context: Cx) -> Result<Schema>;
43 /// Deletes the specified schema from the parent catalog. The caller must be the owner
44 /// of the schema or an owner of the parent catalog.
45 async fn delete_schema(&self, request: DeleteSchemaRequest, context: Cx) -> Result<()>;
46}