Lastiritas opened a new issue #14511:
URL: https://github.com/apache/superset/issues/14511
There is an existing issue with spaces when writing SQL queries with the
`WITH` clause.
It is easy to reproduce.
### Expected results
When making a query like the following without a space between `AS` and `(`.
You should either get a more accurate error message or it should handle it
behind the scenes. With preference on handling it behind the scenes.
```
WITH
test AS(
SELECT *
FROM "marketing"."session_facts"
)
SELECT *
FROM test
```
### Actual results
We currently get the error message:
```
Database error
Only `SELECT` statements are allowed against this database
```
which is misleading as this makes you look at the permissions on the user to
see if they have the ability to create temporary tables to accomplish such
query, but in fact is not an issue with permissions but with a missing space.
Logs:
```
{"log":"[2021-05-06 21:44:57,835: INFO/ForkPoolWorker-31] Task
sql_lab.get_sql_results[53ca608a-087e-4db5-9e38-22a90dacd758] succeeded in
0.1651126181241125s: {'query_id': 360, 'status': 'failed', 'error': 'Only
`SELECT` statements are allowed against this database'}\n"}
```
#### Screenshots

#### How to reproduce the bug
1. Go to SQL Lab
2. Make a query to:
```
WITH
test AS(
SELECT *
FROM "marketing"."session_facts"
)
SELECT *
FROM test
```
3. You would see the Database error
Now if you try the query with the space between `AS` and `(` you don't get
the error
```
WITH
test AS (
SELECT *
FROM "marketing"."session_facts"
)
SELECT *
FROM test
```
### Environment
- superset version: `superset version`
[v2021.18.0](https://github.com/apache/superset/releases/tag/v2021.18.0)
- python version: `python --version` Python 3.7.9
### Checklist
Make sure to follow these steps before submitting your issue - thank you!
- [x] I have checked the superset logs for python stacktraces and included
it here as text if there are any.
- [x] I have reproduced the issue with at least the latest released version
of superset.
- [x] I have checked the issue tracker for the same issue and I haven't
found one similar.
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]