You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2021/03/30 11:49:55 UTC
[GitHub] [superset] villebro commented on a change in pull request #13801: fix(explore): strip semicolons in virtual table SQL
villebro commented on a change in pull request #13801:
URL: https://github.com/apache/superset/pull/13801#discussion_r604023989
##########
File path: tests/sqla_models_tests.py
##########
@@ -223,6 +223,28 @@ def test_incorrect_jinja_syntax_raises_correct_exception(self):
with pytest.raises(QueryObjectValidationError):
table.get_sqla_query(**query_obj)
+ def test_query_format_strip_trailing_semicolon(self):
+ query_obj = {
+ "granularity": None,
+ "from_dttm": None,
+ "to_dttm": None,
+ "groupby": ["user"],
+ "metrics": [],
+ "is_timeseries": False,
+ "filter": [],
+ "extras": {},
+ }
+
+ # Table with Jinja callable.
+ table = SqlaTable(
+ table_name="test_table",
+ sql="SELECT * from test_table;",
+ database=get_example_database(),
+ )
+ sqlaq = table.get_sqla_query(**query_obj)
+ sql = get_example_database().compile_sqla_query(sqlaq.sqla_query)
+ assert sql.match("SELECT * from test_table")
Review comment:
I assume this should be a regular equals assert:
```suggestion
assert sql == "SELECT * from test_table"
```
--
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org