diff --git a/docs/data-modeling/images/turn-into-a-model.png b/docs/data-modeling/images/turn-into-a-model.png index 859ddd68e171104f584a2cad2a681f0711f89515..edcde276b8a44fd3658ca44a0beae76f7e81b5e3 100644 Binary files a/docs/data-modeling/images/turn-into-a-model.png and b/docs/data-modeling/images/turn-into-a-model.png differ diff --git a/docs/questions/images/explore-results.png b/docs/questions/images/explore-results.png new file mode 100644 index 0000000000000000000000000000000000000000..4e8601e99dcdc80ba1e5c5e63265a91f5b75b71f Binary files /dev/null and b/docs/questions/images/explore-results.png differ diff --git a/docs/questions/native-editor/writing-sql.md b/docs/questions/native-editor/writing-sql.md index 0567c4f2d64318370ae4d34a3bcab6eaf0de6fc4..20cbefe5b1b6b39b270f29ea18ad0bbcede29107 100644 --- a/docs/questions/native-editor/writing-sql.md +++ b/docs/questions/native-editor/writing-sql.md @@ -77,6 +77,20 @@ Make sure your SQL dialect matches the database you've selected. Common errors: For more help, see [Troubleshooting SQL error messages](../../troubleshooting-guide/error-message.md#sql-editor). +## Explore SQL question results using the Query Builder + +On saved SQL questions without [parameters](./sql-parameters.md), you'll get the **Explore results** button. It will create a new Query Builder question that uses the SQL question results as a data source. + + + +## To enable drill-through, turn a SQL question into a model and set the data types + +Visualizations created with SQL do not have [drill-through][drill-through] capability. To enable drill-through on a SQL question, you can turn it into a model: + +1. Save the SQL question and [turn it into a model](../../data-modeling/models.md#create-a-model-from-a-saved-question). +2. [Edit the column metadata](../../data-modeling/metadata-editing.md#column-field-settings) in the model's settings. Make sure to set the data types for all the columns. +3. [Create a Query Builder question](../query-builder/introduction.md#creating-a-new-question-with-the-query-builder) based on the model. You should be able to use drill-through on this question, if you configured the metadata correctly. + ## Learn more - [Best practices for writing SQL queries](https://www.metabase.com/learn/sql-questions/sql-best-practices.html) @@ -89,3 +103,4 @@ For more help, see [Troubleshooting SQL error messages](../../troubleshooting-gu [sql-gloss]: https://www.metabase.com/glossary/sql [troubleshooting-sql]: ../../troubleshooting-guide/sql.md [variable-gloss]: https://www.metabase.com/glossary/variable +[drill-through]: https://www.metabase.com/learn/questions/drill-through