sfirke commented on issue #26358:
URL: https://github.com/apache/superset/issues/26358#issuecomment-1871384063

   Thanks for the additional info, good troubleshooting.  If you don't mind I'm 
going to change the issue title to be more specific.
   
   I also use SQL Server.  I agree I can run the query you shared in SQL Lab 
successfully (Superset 3.0.0 for me).  When I save as a dataset, I get a 
different error message on the chart building view:
   > Error: (102, b"Incorrect syntax near ','.DB-Lib error message 20018, 
severity 15:\nGeneral SQL Server error: Check messages from the SQL 
Server\nDB-Lib error message 20018, severity 15:\nGeneral SQL Server error: 
Check messages from the SQL Server\n")
   
   I clicked "View Query" to see what Superset is sending to SQL Server and 
it's this:
   ```
   WITH data,
        __cte AS ( AS (SELECT 1 AS column_name)SELECT * FROM data)
   SELECT TOP 1000 column_name AS column_name
   FROM __cte;
   ```
   Which errors when I run it directly in SQL Server too.
   
   When I repeat the test but with `data2` instead of data, it works.  This is 
the SQL generated and sent to SQL Server:
   ```
   WITH data2 AS
     (SELECT 1 AS column_name),
        __cte AS
     (SELECT *
      FROM data2)
   SELECT TOP 1000 column_name AS column_name
   FROM __cte;
   ```
   
   Different enough that maybe the problem is before SQL Server, it's with how 
the query is getting shaped along the way?  I wonder if others can replicate 
this with a different backend.


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