Get All Questions
Method
REST methods are used. The API is read-only; there are no mutating endpoints.
HTTP Method
GET: Reads from pre-aggregated views
Naming Convention
To keep query parameters and node names consistent and readable, request URIs and JSON nodes use snake_case.
Endpoints follow the hierarchy /api/catalogs/{catalog_name}/schemas/{schema_name}/tables/{table_name}/..., mirroring the Unity Catalog structure directly in the URI.
Request and Response
Headers
Request Headers
Content-Type:application/json
There is no application-specific authentication header (see "Authentication").
Response Headers
Content-Type:application/json
Get All Questions
Returns every question in the given table, with its rows grouped per question. The frontend grid and heatmap views use this endpoint.
URI
Path and Query Parameters
Being a GET, there is no request body.
| Kind | Name | Description |
|---|---|---|
| Path | catalog_name | Unity Catalog catalog name. The frontend hardcodes cs. |
| Path | schema_name | Schema name. The frontend hardcodes cs_dm. |
| Path | table_name | Table name, selected in the UI. |
| Query | question_type | Filters by Text Select / Free Text. No filter when omitted. |
Validation Rules
| Field | Rule |
|---|---|
| catalog_name | Required. ^[A-Za-z0-9_]+$. A violation returns 400. |
| schema_name | Required. ^[A-Za-z0-9_]+$. A violation returns 400. |
| table_name | Required. ^[A-Za-z0-9_]+$. A violation returns 400. |
| question_type | Optional. Passed to SQL as a ? placeholder, so no format constraint. |
Note that aggregation queries always filter by is_comp = 'ใในใฆใฎๆๅนๅ็ญ'. That condition is not parameterized.
Response (200 OK)
The response is JSON. The schema field is schema_name in Pydantic, but alias="schema" renders it as schema in JSON.
{
"catalog": "cs",
"schema": "cs_dm",
"table": "dm_vis_jreslso_tokyo23_comp_test",
"questions": [
{
"question": "็พๅจใฎๅคๅๅฝขๆ
ใซใคใใฆๆใใฆใใ ใใ",
"question_number": "03",
"question_type": "Text Select",
"data": [
{
"question_number": "03",
"question_type": "Text Select",
"question": "็พๅจใฎๅคๅๅฝขๆ
ใซใคใใฆๆใใฆใใ ใใ",
"choice_text": "ๅบ็คพใฎใฟ",
"sum_answer": 412,
"total": 1000,
"rate": 0.412,
"n": 1000,
"is_comp": "ใในใฆใฎๆๅนๅ็ญ"
}
]
}
]
}
Each row in data uses extra="allow", so table-specific extra columns may appear as-is.
Other Endpoints
| URI | Summary | Main Parameters |
|---|---|---|
GET /api/health |
Health check; returns {"status": "healthy"} |
- |
GET /api/catalogs/{catalog_name}/schemas |
Lists schemas in the catalog (via the Workspace API) | - |
GET /api/catalogs/{catalog_name}/schemas/{schema_name}/tables |
Lists tables in the schema (via the Workspace API) | - |
GET /api/catalogs/{c}/schemas/{s}/tables/{t}/questions |
Lists questions in the table (SELECT DISTINCT) |
question_type |
GET /api/catalogs/{c}/schemas/{s}/tables/{t}/questions/{question} |
Returns the rows of a single question | - |
GET /api/data_sql |
Development sample; returns question_number='03' from cs.cs_dm.dm_vis_jreslso_tokyo23_comp_test |
- |
GET /api/dm_vis_jreslso_tokyo23_comp_test |
Development sample; returns the same view with filters | question_number (default 03), is_comp (default ใในใฆใฎๆๅนๅ็ญ) |
Full details for every endpoint are available in the Swagger UI (http://localhost:8000/api/docs).
Authentication
There is no application-specific authentication. End-user access control is delegated to Databricks Apps.
The app connects to Databricks with an OAuth service principal (M2M) using DATABRICKS_CLIENT_ID / DATABRICKS_CLIENT_SECRET. The data visible through the app is bounded by the Unity Catalog grants held by that service principal.
Error Handling
Status codes on error are as follows. Each handler in routes/ maps them from the exception type.
| Description | Status Code | Status Name |
|---|---|---|
Identifier violates the allowlist (ValueError) |
400 | Bad Request |
| FastAPI request validation failure | 422 | Unprocessable Entity |
| Internal server error | 500 | Internal Server Error |
Missing configuration or uninstalled dependency (RuntimeError) |
503 | Service Unavailable |
Processing Flow
Sequence Diagram
sequenceDiagram
participant Client
participant API as FastAPI (routes)
participant SQL as backend/sql
participant Warehouse as SQL Warehouse
Client->>API: GET .../all_questions?question_type=Text Select
API->>SQL: asyncio.to_thread(fetch_all_questions)
SQL->>SQL: Validate identifiers via fully_qualified_name
SQL->>Warehouse: SELECT ... WHERE is_comp = 'ใในใฆใฎๆๅนๅ็ญ' AND question_type = ?
Warehouse-->>SQL: Rows
SQL->>SQL: Group by question
SQL-->>API: List[Dict]
API-->>Client: 200 OK (AllQuestionsResponse)