mirror of
https://github.com/apache/superset.git
synced 2026-04-09 11:25:23 +00:00
Make schema name for the CTA queries and limit configurable (#8867)
* Make schema name configurable
Fixing unit tests
Fix table quoting
Mypy
Split tests out for sqlite
Grant more permissions for mysql user
Postgres doesn't support if not exists
More logging
Commit for table creation
Priviliges for postgres
Update tests
Resolve comments
Lint
No limits for the CTA queries if configures
* CTA -> CTAS and dict -> {}
* Move database creation to the .travis file
* Black
* Move tweaks to travis db setup
* Remove left over version
* Address comments
* Quote table names in the CTAS queries
* Pass tmp_schema_name for the query execution
* Rebase alembic migration
* Switch to python3 mypy
* SQLLAB_CTA_SCHEMA_NAME_FUNC -> SQLLAB_CTAS_SCHEMA_NAME_FUNC
* Black
This commit is contained in:
@@ -451,19 +451,28 @@ class SupersetTestCase(unittest.TestCase):
|
||||
def test_get_query_with_new_limit_comment(self):
|
||||
sql = "SELECT * FROM birth_names -- SOME COMMENT"
|
||||
parsed = sql_parse.ParsedQuery(sql)
|
||||
newsql = parsed.get_query_with_new_limit(1000)
|
||||
newsql = parsed.set_or_update_query_limit(1000)
|
||||
self.assertEqual(newsql, sql + "\nLIMIT 1000")
|
||||
|
||||
def test_get_query_with_new_limit_comment_with_limit(self):
|
||||
sql = "SELECT * FROM birth_names -- SOME COMMENT WITH LIMIT 555"
|
||||
parsed = sql_parse.ParsedQuery(sql)
|
||||
newsql = parsed.get_query_with_new_limit(1000)
|
||||
newsql = parsed.set_or_update_query_limit(1000)
|
||||
self.assertEqual(newsql, sql + "\nLIMIT 1000")
|
||||
|
||||
def test_get_query_with_new_limit(self):
|
||||
def test_get_query_with_new_limit_lower(self):
|
||||
sql = "SELECT * FROM birth_names LIMIT 555"
|
||||
parsed = sql_parse.ParsedQuery(sql)
|
||||
newsql = parsed.get_query_with_new_limit(1000)
|
||||
newsql = parsed.set_or_update_query_limit(1000)
|
||||
# not applied as new limit is higher
|
||||
expected = "SELECT * FROM birth_names LIMIT 555"
|
||||
self.assertEqual(newsql, expected)
|
||||
|
||||
def test_get_query_with_new_limit_upper(self):
|
||||
sql = "SELECT * FROM birth_names LIMIT 1555"
|
||||
parsed = sql_parse.ParsedQuery(sql)
|
||||
newsql = parsed.set_or_update_query_limit(1000)
|
||||
# applied as new limit is lower
|
||||
expected = "SELECT * FROM birth_names LIMIT 1000"
|
||||
self.assertEqual(newsql, expected)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user