Implementation:TobikoData Sqlmesh API Meta
| Knowledge Sources | |
|---|---|
| Domains | Web_Server, REST_API |
| Last Updated | 2026-02-07 20:00 GMT |
Overview
Concrete tool for retrieving SQLMesh server metadata and status provided by the SQLMesh web server.
Description
This module exposes a FastAPI endpoint that returns server metadata including the SQLMesh version and running task status. When the plans module is enabled, it checks for active background tasks and logs plan events. The endpoint also manages plan cancellation state, finishing cancellation operations when no tasks are running.
Usage
This endpoint is called by the SQLMesh web UI on initial load and periodically to check server status. The version information displays the SQLMesh version in the UI. The `has_running_task` flag controls UI state for plan operations, disabling certain actions when background tasks are executing.
Code Reference
Source Location
- Repository: TobikoData_Sqlmesh
- File: web/server/api/endpoints/meta.py
Signature
@router.get(
"",
response_model=models.Meta,
response_model_exclude_unset=True,
)
def get_api_meta(
request: Request,
settings: Settings = Depends(get_settings),
) -> models.Meta
Import
from web.server.api.endpoints.meta import router
I/O Contract
Inputs
| Endpoint | Method | Parameters | Description |
|---|---|---|---|
| /api/meta | GET | None | Retrieves server metadata and status |
Outputs
| Endpoint | Response Type | Description |
|---|---|---|
| /api/meta | Meta | Server version and running task status |
Usage Examples
# Get server metadata
import httpx
response = httpx.get("http://localhost:8000/api/meta")
metadata = response.json()
# {
# "version": "0.123.0",
# "has_running_task": false
# }
# Check if task is running before starting new operation
metadata = httpx.get("http://localhost:8000/api/meta").json()
if not metadata["has_running_task"]:
# Safe to start new plan
httpx.post("http://localhost:8000/api/plan", ...)