villebro commented on a change in pull request #13153:
URL: https://github.com/apache/superset/pull/13153#discussion_r577560380
##########
File path: tests/sql_parse_tests.py
##########
@@ -732,3 +732,15 @@ def test_is_valid_cvas(self):
"""
parsed = ParsedQuery(query, strip_comments=True)
assert not parsed.is_valid_ctas()
+
+ def test_strip_comments_from_sql(self):
+ """Test that we are able to strip comments out of SQL stmts"""
+
+ assert (
+ strip_comments_from_sql("SELECT col1, col2 FROM table1")
+ == "SELECT col1, col2 FROM table1"
+ )
+ assert (
+ strip_comments_from_sql("SELECT col1, col2 FROM table1\n--
comment")
+ == "SELECT col1, col2 FROM table1\n"
+ )
Review comment:
Let's add one more:
```python
assert (
strip_comments_from_sql("SELECT '--abc' as abc, col2 FROM
table1\n")
== "SELECT '--abc' as abc, col2 FROM table1\n"
)
````
----------------------------------------------------------------
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]