mirror of
https://github.com/apache/superset.git
synced 2026-04-19 08:04:53 +00:00
This commit is contained in:
committed by
GitHub
parent
a2947d0c23
commit
c9aa4a1f84
@@ -304,7 +304,6 @@ def virtual_dataset():
|
||||
"SELECT 3 as col1, 'd' as col2, 1.3, NULL, '2000-01-04 00:00:00', 4 "
|
||||
"UNION ALL "
|
||||
"SELECT 4 as col1, 'e' as col2, 1.4, NULL, '2000-01-05 00:00:00', 5 "
|
||||
"\n /* CONTAINS A RANDOM COMMENT */ \n"
|
||||
"UNION ALL "
|
||||
"SELECT 5 as col1, 'f' as col2, 1.5, NULL, '2000-01-06 00:00:00', 6 "
|
||||
"UNION ALL "
|
||||
|
||||
@@ -540,9 +540,7 @@ class TestCore(SupersetTestCase):
|
||||
database=get_example_database(),
|
||||
)
|
||||
rendered_query = str(table.get_from_clause()[0])
|
||||
assert "comment 1" in rendered_query
|
||||
assert "comment 2" in rendered_query
|
||||
assert "FROM tbl" in rendered_query
|
||||
self.assertEqual(clean_query, rendered_query)
|
||||
|
||||
def test_slice_payload_no_datasource(self):
|
||||
form_data = {
|
||||
|
||||
@@ -538,12 +538,10 @@ def test_get_samples(test_client, login_as_admin, virtual_dataset):
|
||||
assert "coltypes" in rv2.json["result"]
|
||||
assert "data" in rv2.json["result"]
|
||||
|
||||
sql = (
|
||||
f"select * from ({virtual_dataset.sql}) as tbl "
|
||||
f'limit {app.config["SAMPLES_ROW_LIMIT"]}'
|
||||
eager_samples = virtual_dataset.database.get_df(
|
||||
f"select * from ({virtual_dataset.sql}) as tbl"
|
||||
f' limit {app.config["SAMPLES_ROW_LIMIT"]}'
|
||||
)
|
||||
eager_samples = virtual_dataset.database.get_df(sql)
|
||||
|
||||
# the col3 is Decimal
|
||||
eager_samples["col3"] = eager_samples["col3"].apply(float)
|
||||
eager_samples = eager_samples.to_dict(orient="records")
|
||||
|
||||
@@ -575,9 +575,9 @@ class TestSqlLab(SupersetTestCase):
|
||||
assert data["status"] == "success"
|
||||
|
||||
data = self.run_sql(
|
||||
"SELECT * FROM birth_names WHERE state = '{{ state }}' -- blabblah {{ extra1 }}\nLIMIT 10",
|
||||
"SELECT * FROM birth_names WHERE state = '{{ state }}' -- blabblah {{ extra1 }} {{fake.fn()}}\nLIMIT 10",
|
||||
"3",
|
||||
template_params=json.dumps({"state": "CA", "extra1": "comment"}),
|
||||
template_params=json.dumps({"state": "CA"}),
|
||||
)
|
||||
assert data["status"] == "success"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user