aminghadersohi commented on code in PR #44130: URL: https://github.com/apache/superset/pull/44130#discussion_r4174184444
########## docs/docs/using-superset/using-ai-with-superset.mdx: ########## @@ -126,6 +126,32 @@ Build ad-hoc SQL datasets that can be used as the basis for charts: > "Create a dataset from: SELECT region, SUM(revenue) as total_revenue FROM > orders GROUP BY region" > "Make a virtual dataset called 'monthly_signups' from the users table > filtered to last 12 months" +### Query the Semantic Layer + +Discover and query metrics across both built-in datasets and external semantic +views (when your deployment has semantic views registered), without writing SQL: + +- **Discover metrics** -- search metrics by name or description across every dataset and semantic view you can access, optionally including each metric's compatible dimensions +- **Query by metric and dimension** -- get tabular results by naming metrics and dimensions instead of writing SQL, with optional filters and time ranges +- **Progressively refine a query** -- given metrics and/or dimensions already picked, see which dimensions and metrics are compatible with that selection + +**Example prompts:** + +> "What metrics are available related to revenue?" +> "Show me revenue by region for the last 30 days" +> "I've picked the revenue metric -- what dimensions can I break it down by?" + +:::tip Recommended workflow +1. **`list_metrics`** -- search for a metric; note its `dataset_id` (built-in) or `view_id` (external semantic view) +2. **`get_table`** -- pass that `dataset_id`/`view_id` along with metric and dimension names to get results Review Comment: Since https://github.com/apache/superset/pull/44370 (merged after this PR's last push), `get_table` on a versioned external view rejects a request without `semantic_selection_version` (`get_table.py:199`), returning a ValidationError. Steps 1-2 never mention it. ```suggestion 1. **`list_metrics`** -- search for a metric; note its `dataset_id` (built-in) or `view_id` (external semantic view), plus its `semantic_selection_version` when non-null 2. **`get_table`** -- pass that `dataset_id`/`view_id` (and, for a versioned external view, its `semantic_selection_version`) along with metric and dimension names to get results ``` -- 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]
