Closed JurajBurian closed 8 months ago
Taking a look.
@JurajBurian per the PostgreSQL documentation it seems like your WITH
statement might not be correct, i.e., it should be of the form:
WITH data AS ( ...
That said some of these examples can't be parsed by SQLGlot which use the NOT MATERIALIZED
construct. This would likely indicate an issue with the SQLGlot parser.
@john-bodley in documnetation you mentioned is part about materialization (see: 7.8.3. Common Table Expression Materialization) . One can write with xxx as (not) materialized ( ... ) select xxx ....
Here is screnshot from dbeaver running my query ...
As I mentioned, there is probably problem with sqlglot (may be somebody changed version ?) or there is not correctly detected sql dialect.
We have strored fresh but not last "master" docker image (created: 2024-03-05T13:05:22.874959317Z) that is able parse our selects corectly.
We did't have any problem with this in past.
Right, it is a valid query and should work unquoted (double quoting it is a syntax error).
@JurajBurian is it easy for to test with a newer version of sqlglot?
Though I think this is caused by how we wrap the SQL Lab query when creating charts. I was able to repro, I'm taking a look now.
I filed a ticked upstream (https://github.com/tobymao/sqlglot/issues/3170), I'm going to give it a try and see if it's something easy to fix.
Fixed in https://github.com/tobymao/sqlglot/pull/3171 in record time, I'll bump the version in Superset as soon as there's a new release.
Hello Folks, I want just inform you for future. I found https://codapi.org/try/sqlglot/ site, where one can test sqlglot. (and yes, version used by site has bug with materialized )
Bug description
I am testing the latest master image (created 2024-03-13T22:31:57.559418117Z ) and I see that a new problem is happening. The error occurs when a native filter or dashboard (chart) requests data. We are using Postgres and the parser throws an exception like this:
problem is in ... as
materialized
... part. When I remove materialized keyword, everything is working fine. I am 100% that previous build of master is working correctly - we alredy use it in production ! Also my coluege find that there is problem wit LATERAL keyword, here is example :SELECT * FROM table_a a, inner join LATERAL ( SELECT value FROM table_b WHERE table_b.id = a.id)
Not sure what is root cause of the problem. May be a new version of sqlglot library or dialect is not recognized ?
How to reproduce the bug
Screenshots/recordings
Superset version
master / latest-dev
Python version
I don't know
Node version
I don't know
Browser
Chrome
Additional context
No response
Checklist