prefect.server.models.block_types

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

Functions

create_block_type

create_block_type(db: PrefectDBInterface, session: AsyncSession, block_type: Union[schemas.core.BlockType, 'ClientBlockType'], override: bool = False) -> Union[BlockType, None]
Create a new block type. Args:
  • session: A database session
  • block_type: a block type object
Returns:
  • an ORM block type model

read_block_type

read_block_type(db: PrefectDBInterface, session: AsyncSession, block_type_id: UUID) -> Union[BlockType, None]
Reads a block type by id. Args:
  • session: A database session
  • block_type_id: a block_type id
Returns:
  • an ORM block type model

read_block_type_by_slug

read_block_type_by_slug(db: PrefectDBInterface, session: AsyncSession, block_type_slug: str) -> Union[BlockType, None]
Reads a block type by slug. Args:
  • session: A database session
  • block_type_slug: a block type slug
Returns:
  • an ORM block type model

read_block_types

read_block_types(db: PrefectDBInterface, session: AsyncSession, block_type_filter: Optional[schemas.filters.BlockTypeFilter] = None, block_schema_filter: Optional[schemas.filters.BlockSchemaFilter] = None, limit: Optional[int] = None, offset: Optional[int] = None) -> Sequence[BlockType]
Reads block types with an optional limit and offset Args: Returns:
  • List[BlockType]: List of

update_block_type

update_block_type(db: PrefectDBInterface, session: AsyncSession, block_type_id: Union[str, UUID], block_type: Union[schemas.actions.BlockTypeUpdate, schemas.core.BlockType, 'ClientBlockTypeUpdate', 'ClientBlockType']) -> bool
Update a block type by id. Args:
  • session: A database session
  • block_type_id: Data to update block type with
  • block_type: A block type id
Returns:
  • True if the block type was updated

delete_block_type

delete_block_type(db: PrefectDBInterface, session: AsyncSession, block_type_id: str) -> bool
Delete a block type by id. Args:
  • session: A database session
  • block_type_id: A block type id
Returns:
  • True if the block type was updated