villebro opened a new issue #4412: Comment row at end of query in SQL Lab fails 
to render in Explore window
   Make sure these boxes are checked before submitting your issue - thank you!
   - [x] I have checked the superset logs for python stacktraces and included 
it here as text if 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
   ### Superset version
   ### Expected results
   When commenting out the last lines in a query in the SQL Lab UI, the query 
runs just fine. This is rather common when developing new queries to match the 
exact use case. However, when pressing "Visualize", the query fails due to the 
"--" leaking into the closing of the subquery. This can be seen in  I tried 
doing a quick hack of adding "\n\n" to the end of the query in the 
connectors/sqla/ file fixed the issue. I am glad to make a more 
elegant fix if someone can give me some guidance on the preferred type of fix.
   diff --git a/superset/connectors/sqla/ 
   index b2e21c7d..ff1a37a8 100644
   --- a/superset/connectors/sqla/
   +++ b/superset/connectors/sqla/
   @@ -423,7 +423,7 @@ class SqlaTable(Model, BaseDatasource):
        def get_from_clause(self, template_processor=None, db_engine_spec=None):
            # Supporting arbitrary SQL statements in place of tables
            if self.sql:
   -            from_sql = self.sql
   +            from_sql = self.sql + "\n\n"
                if template_processor:
                    from_sql = template_processor.process_template(from_sql)
                if db_engine_spec:
   <img width="828" alt="screen shot 2018-02-13 at 9 51 12" 
   ### Actual results
   <img width="830" alt="screen shot 2018-02-13 at 9 50 04" 
   <img width="1091" alt="screen shot 2018-02-13 at 11 13 53" 
   ### Steps to reproduce
   <img width="946" alt="screen shot 2018-02-13 at 9 50 15" 

This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:

With regards,
Apache Git Services

Reply via email to