prefect.server.api.variables

Routes for interacting with variable objects

Functions

get_variable_or_404

get_variable_or_404(session: AsyncSession, variable_id: UUID) -> orm_models.Variable
Returns a variable or raises 404 HTTPException if it does not exist

get_variable_by_name_or_404

get_variable_by_name_or_404(session: AsyncSession, name: str) -> orm_models.Variable
Returns a variable or raises 404 HTTPException if it does not exist

create_variable

create_variable(variable: actions.VariableCreate, db: PrefectDBInterface = Depends(provide_database_interface)) -> core.Variable
Create a variable. For more information, see https://docs.prefect.io/v3/develop/variables.

read_variable

read_variable(variable_id: UUID = Path(..., alias='id'), db: PrefectDBInterface = Depends(provide_database_interface)) -> core.Variable

read_variable_by_name

read_variable_by_name(name: str = Path(...), db: PrefectDBInterface = Depends(provide_database_interface)) -> core.Variable

read_variables

read_variables(limit: int = LimitBody(), offset: int = Body(0, ge=0), variables: Optional[filters.VariableFilter] = None, sort: sorting.VariableSort = Body(sorting.VariableSort.NAME_ASC), db: PrefectDBInterface = Depends(provide_database_interface)) -> List[core.Variable]

count_variables

count_variables(variables: Optional[filters.VariableFilter] = Body(None, embed=True), db: PrefectDBInterface = Depends(provide_database_interface)) -> int

update_variable

update_variable(variable: actions.VariableUpdate, variable_id: UUID = Path(..., alias='id'), db: PrefectDBInterface = Depends(provide_database_interface)) -> None

update_variable_by_name

update_variable_by_name(variable: actions.VariableUpdate, name: str = Path(..., alias='name'), db: PrefectDBInterface = Depends(provide_database_interface)) -> None

delete_variable

delete_variable(variable_id: UUID = Path(..., alias='id'), db: PrefectDBInterface = Depends(provide_database_interface)) -> None

delete_variable_by_name

delete_variable_by_name(name: str = Path(...), db: PrefectDBInterface = Depends(provide_database_interface)) -> None