Skip to main content

prefect.server.models.block_schemas

Functions for interacting with block schema ORM objects. Intended for internal use by the Prefect REST API.

Functions

create_block_schema

Create a new block schema. Args:
  • session: A database session
  • block_schema: a block schema object
  • definitions: Definitions of fields from block schema fields attribute. Used when recursively creating nested block schemas
Returns:
  • an ORM block schema model

delete_block_schema

Delete a block schema by id. Args:
  • session: A database session
  • block_schema_id: a block schema id
Returns:
  • whether or not the block schema was deleted

read_block_schema

Reads a block schema by id. Will reconstruct the block schema’s fields attribute to include block schema references. Args:
  • session: A database session
  • block_schema_id: a block_schema id
Returns:
  • orm_models..BlockSchema: the block_schema

read_block_schemas

Reads block schemas, optionally filtered by type or name. Args:
  • session: A database session
  • block_schema_filter: a block schema filter object
  • limit: query limit
  • offset: query offset
Returns:
  • List[orm_models.BlockSchema]: the block_schemas

read_block_schema_by_checksum

Reads a block_schema by checksum. Will reconstruct the block schema’s fields attribute to include block schema references. Args:
  • session: A database session
  • checksum: a block_schema checksum
  • version: A block_schema version
Returns:
  • orm_models.BlockSchema: the block_schema

read_available_block_capabilities

Retrieves a list of all available block capabilities. Args:
  • session: A database session.
Returns:
  • List[str]: List of all available block capabilities.

create_block_schema_reference

Retrieves a list of all available block capabilities. Args:
  • session: A database session.
  • block_schema_reference: A block schema reference object.
Returns:
  • orm_models.BlockSchemaReference: The created BlockSchemaReference

Classes

MissingBlockTypeException

Raised when the block type corresponding to a block schema cannot be found