The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:
TypeScript analyticsbibusiness-intelligencebusinessintelligenceclojuredashboarddatadata-analysisdata-visualizationdatabasemetabasemysqlpostgrespostgresqlreportingslacksql-editorvisualization
docs - impersonation notes (#79768)
Jeff Bruemmerb8e6d94a47bd
diff --git a/docs/permissions/impersonation.md b/docs/permissions/impersonation.mdindex a7bf0b2cc9d..c8b33cf7dff 100644--- a/docs/permissions/impersonation.md+++ b/docs/permissions/impersonation.md@@ -169,6 +169,16 @@ If instead you want to give a group SQL access to some, but not all, of the scheConnection impersonation doesn't apply to people in the Metabase Admins group, as their more permissive privileges take precedence.+## Impersonated queries must be a single SELECT statement++When people with impersonated access use the native SQL editor, they will only be able to write queries with a single select statement. Metabase will check each native query before running it and reject anything that isn't a single `SELECT` statement. Common table expressions (`WITH`) and set operations (`UNION`, `INTERSECT`, `EXCEPT`) count as a single `SELECT` statement, so those queries will run.++Examples of queries Metabase will reject:++- Multiple statements separated by semicolons, like `SET ROLE analyst; SELECT * FROM people;`+- Statements that create or change tables, including temporary tables (`CREATE`, `ALTER`, `DROP`)+- Role-switching statements like `SET ROLE` or `USE ROLE`+## Metabase gives people the most permissive access to data across all of their groupsSo if a person is in two groups with different permissions for the same database:diff --git a/docs/questions/native-editor/writing-sql.md b/docs/questions/native-editor/writing-sql.mdindex 352542334d6..59dec8a3d28 100644--- a/docs/questions/native-editor/writing-sql.md+++ b/docs/questions/native-editor/writing-sql.md@@ -94,9 +94,9 @@ You can use [Snippets](snippets.md) to save, reuse, and share SQL code across muWhen you run a query from the SQL editor, Metabase sends the query to your database exactly as it is written. Any results or errors displayed in Metabase are the same as the results or errors that you would get if you ran the query directly against your database. If the SQL syntax of your query doesn’t match the SQL dialect used by your database, your database won’t be able to run the query.-## The native query editor is designed for reading data, not writing it+## SQL commands the editor doesn't support-The native SQL editor is designed for asking questions about your data. Don't use the editor for:+The native SQL editor is designed for asking questions about your data. The editor doesn't support:- Multi-statement queries- Stored procedures and function calls@@ -104,6 +104,8 @@ The native SQL editor is designed for asking questions about your data. Don't usDepending on your connection's privileges, some of the above actions may work, but none are officially supported, and we recommend against using the native query editor for these tasks.+On databases that use [impersonation](../../permissions/impersonation.md), Metabase enforces this: queries must be a single `SELECT` statement, and Metabase will reject multi-statement queries, temporary tables, and DDL.+## Question version historyFor questions, [dashboards](../../dashboards/start.md), and [models](../../data-modeling/models.md), Metabase keeps a version history for the previous fifteen versions of that item.