Back to Prefect

variables

docs/v3/api-ref/python/prefect-server-api-variables.mdx

3.6.30.dev34.3 KB
Original Source

prefect.server.api.variables

Routes for interacting with variable objects

Functions

get_variable_or_404 <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/api/variables.py#L23" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
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 <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/api/variables.py#L37" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
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 <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/api/variables.py#L56" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
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/concepts/variables.

read_variable <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/api/variables.py#L80" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

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

read_variable_by_name <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/api/variables.py#L91" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

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

read_variables <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/api/variables.py#L102" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
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 <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/api/variables.py#L120" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

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

update_variable <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/api/variables.py#L132" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

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

update_variable_by_name <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/api/variables.py#L148" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

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

delete_variable <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/api/variables.py#L164" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

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

delete_variable_by_name <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/api/variables.py#L177" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

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