mason-gordon commented on issue #25659:
URL: https://github.com/apache/superset/issues/25659#issuecomment-4091268306

   Using Superset 4.1.1, I ran into a different stack trace that resulted in 
the same error: Only `SELECT` statements are allowed.
   ```python
   superset_app          | Traceback (most recent call last):
   superset_app          |   File 
"/usr/local/lib/python3.10/site-packages/flask_appbuilder/api/__init__.py", 
line 111, in wraps
   superset_app          |     return f(self, *args, **kwargs)
   superset_app          |   File "/app/superset/views/base_api.py", line 119, 
in wraps
   superset_app          |     duration, response = time_function(f, self, 
*args, **kwargs)
   superset_app          |   File "/app/superset/utils/core.py", line 1364, in 
time_function
   superset_app          |     response = func(*args, **kwargs)
   superset_app          |   File "/app/superset/utils/log.py", line 303, in 
wrapper
   superset_app          |     value = f(*args, **kwargs)
   superset_app          |   File "/app/superset/views/base_api.py", line 91, 
in wraps
   superset_app          |     return f(self, *args, **kwargs)
   superset_app          |   File "/app/superset/datasets/api.py", line 337, in 
post
   superset_app          |     new_model = CreateDatasetCommand(item).run()
   superset_app          |   File "/app/superset/utils/decorators.py", line 
266, in wrapped
   superset_app          |     return on_error(ex)
   superset_app          |   File "/app/superset/utils/decorators.py", line 
236, in on_error
   superset_app          |     raise ex
   superset_app          |   File "/app/superset/utils/decorators.py", line 
259, in wrapped
   superset_app          |     result = func(*args, **kwargs)
   superset_app          |   File "/app/superset/commands/dataset/create.py", 
line 51, in run
   superset_app          |     dataset.fetch_metadata()
   superset_app          |   File "/app/superset/connectors/sqla/models.py", 
line 1814, in fetch_metadata
   superset_app          |     new_columns = self.external_metadata()
   superset_app          |   File "/app/superset/connectors/sqla/models.py", 
line 1377, in external_metadata
   superset_app          |     return get_virtual_table_metadata(dataset=self)
   superset_app          |   File "/app/superset/connectors/sqla/utils.py", 
line 110, in get_virtual_table_metadata
   superset_app          |     raise SupersetSecurityException(
   superset_app          | superset.exceptions.SupersetSecurityException: Only 
`SELECT` statements are allowed
   ```
   
   My query did not have a union, only CTEs. This suggestion from @rahmedrbx 
solved the problem.
   
   > [@rahmedrbx](https://github.com/rahmedrbx) Spent 2 hours trying to solve 
it. In my case enclosing CTEs with brackets helped, i.e.
   > 
   > ```
   > with "a" as (),
   > "b" as (),
   > ```
   > 
   > etc. There a lot of issues that seem to be related to some one problem: 
[#22704](https://github.com/apache/superset/issues/22704)
   > 
   > p.s. none of the things that have to do with TALISMAN or CSRF tokens 
helped.
   
   
   
   
   
   


-- 
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]

Reply via email to