prefect.server.models.logs

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

Functions

split_logs_into_batches

split_logs_into_batches(logs: Sequence[schemas.actions.LogCreate]) -> Generator[Tuple[LogCreate, ...], None, None]

create_logs

create_logs(db: PrefectDBInterface, session: AsyncSession, logs: Sequence[LogCreate]) -> None
Creates new logs Args:
  • session: a database session
  • logs: a list of log schemas
Returns:
  • None

read_logs

read_logs(db: PrefectDBInterface, session: AsyncSession, log_filter: Optional[schemas.filters.LogFilter], offset: Optional[int] = None, limit: Optional[int] = None, sort: schemas.sorting.LogSort = schemas.sorting.LogSort.TIMESTAMP_ASC) -> Sequence[orm_models.Log]
Read logs. Args:
  • session: a database session
  • db: the database interface
  • log_filter: only select logs that match these filters
  • offset: Query offset
  • limit: Query limit
  • sort: Query sort
Returns:
  • List[orm_models.Log]: the matching logs

delete_logs

delete_logs(db: PrefectDBInterface, session: AsyncSession, log_filter: schemas.filters.LogFilter) -> int