You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by di...@apache.org on 2023/01/25 15:31:40 UTC

[superset] 02/02: Validate rendered query

This is an automated email from the ASF dual-hosted git repository.

diegopucci pushed a commit to branch fix/jinja-schema-auth
in repository https://gitbox.apache.org/repos/asf/superset.git

commit c78943f50342490b9468bd01466e2a2dcc102b4d
Author: geido <di...@gmail.com>
AuthorDate: Wed Jan 25 16:31:21 2023 +0100

    Validate rendered query
---
 superset/sqllab/command.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/superset/sqllab/command.py b/superset/sqllab/command.py
index 35a761fab4..79bee8ce60 100644
--- a/superset/sqllab/command.py
+++ b/superset/sqllab/command.py
@@ -142,9 +142,11 @@ class ExecuteSqlCommand(BaseCommand):
         self._save_new_query(query)
         try:
             logger.info("Triggering query_id: %i", query.id)
-            self._validate_access(query)
+
             self._execution_context.set_query(query)
             rendered_query = self._sql_query_render.render(self._execution_context)
+            query.sql = rendered_query
+            self._validate_access(query)
             self._set_query_limit_if_required(rendered_query)
             self._query_dao.update(
                 query, {"limit": self._execution_context.query.limit}