shivamgoel opened a new issue, #37535: URL: https://github.com/apache/superset/issues/37535
*Please make sure you are familiar with the SIP process documented* [here](https://github.com/apache/superset/issues/5602). The SIP will be numbered by a committer upon acceptance. ## [SIP] Proposal for Simplified Dataset Query API for Headless Service Integration ### Motivation As Apache Superset moves toward a "Library-First" architecture (per SIP-187) and seeks to centralize analytical logic (per SIP-185), the current API surface remains heavily tied to the Visualization (Chart) layer. Currently, external services or AI agents wishing to query a Dataset must either: 1. Reference a slice_id (Chart), which forces a dependency on UI state. 2. Construct a complex query_context designed for frontend state management. We need a Dataset-centric API that allows services to fetch data using only the semantic definitions (metrics/columns) of a Dataset, treating Superset as a headless semantic layer. ### Proposed Change I propose a new REST endpoint: `POST` `/api/v1/dataset/{id}/query` This endpoint will accept a simplified JSON payload and execute it via a new, standalone DatasetQueryCommand. This command will bypass visualization metadata and focus purely on data retrieval. Key Architectural Principles: * Library-First: The core logic will reside in a Command class that does not depend on the Flask request context, making it usable by the SIP-187 MCP service. * Shared Logic: The command will utilize the QueryObjectFactory and satisfy the requirements of SIP-185 to ensure calculation parity across all interfaces. * Schema Validation: High-fidelity validation using Marshmallow/Pydantic to provide helpful error messages (e.g., suggesting correct metric names). ### New or Changed Public Interfaces Endpoint: `POST` `/api/v1/dataset/{id}/query` Request Payload: JSON ``` { "columns": ["region", "product_category"], "metrics": ["sum__sales", "unique_users"], "filters": [ {"col": "order_date", "op": "TEMPORAL_RANGE", "val": "Last 7 days"} ], "series_limit": 100, "order_desc": true, "result_format": "json" } ``` ### New dependencies None ### Migration Plan and Compatibility * This is a new endpoint; no breaking changes to existing APIs. * No database migrations required. ### Rejected Alternatives Keep using the existing `POST /api/v1/chart/data` API -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
