Get a variable's value.
(name: str)
| 136 | @variable_app.command(name="get") |
| 137 | @with_cli_exception_handling |
| 138 | async def get(name: str): |
| 139 | """Get a variable's value.""" |
| 140 | from prefect.client.orchestration import get_client |
| 141 | |
| 142 | async with get_client() as client: |
| 143 | variable = await client.read_variable_by_name(name=name) |
| 144 | if variable: |
| 145 | _cli.console.print(json.dumps(variable.value)) |
| 146 | else: |
| 147 | exit_with_error(f"Variable {name!r} not found.") |
| 148 | |
| 149 | |
| 150 | @variable_app.command(name="set") |
no test coverage detected