chore: Support SET & SHOW commands as read only SQL commands (#11868)

* Support SET & SHOW commands as read only SQL commands

* Move is_readonly definition into the engine spec

* Rename & use super()

Co-authored-by: bogdan kyryliuk <bogdankyryliuk@dropbox.com>
This commit is contained in:
Bogdan
2020-12-03 10:44:11 -08:00
committed by GitHub
parent 38d21acff6
commit 0396c705d4
11 changed files with 124 additions and 16 deletions

View File

@@ -36,6 +36,7 @@ import pandas as pd
import sqlalchemy as sqla
from superset.models.cache import CacheKey
from superset.utils.core import get_example_database
from tests.test_app import app # isort:skip
import superset.views.utils
from superset import (
@@ -817,7 +818,9 @@ class TestCore(SupersetTestCase):
clean_query = "SELECT '/* val 1 */' as c1, '-- val 2' as c2 FROM tbl"
commented_query = "/* comment 1 */" + clean_query + "-- comment 2"
table = SqlaTable(
table_name="test_comments_in_sqlatable_query_table", sql=commented_query
table_name="test_comments_in_sqlatable_query_table",
sql=commented_query,
database=get_example_database(),
)
rendered_query = str(table.get_from_clause())
self.assertEqual(clean_query, rendered_query)