Skip to content
Permalink
Browse files

Allow EXPLAIN WITH... - closes #583

  • Loading branch information...
simonw committed Oct 6, 2019
1 parent a314b76 commit fffd69ec031b83f46680f192ba57a27f0d1f0b8a
Showing with 6 additions and 0 deletions.
  1. +2 −0 datasette/utils/__init__.py
  2. +4 −0 tests/test_utils.py
@@ -167,6 +167,8 @@ class InvalidSql(Exception):
re.compile(r"^explain select\b"),
re.compile(r"^explain query plan select\b"),
re.compile(r"^with\b"),
re.compile(r"^explain with\b"),
re.compile(r"^explain query plan with\b"),
]
disallawed_sql_res = [(re.compile("pragma"), "Statement may not contain PRAGMA")]

@@ -151,8 +151,12 @@ def test_validate_sql_select_bad(bad_sql):
"select count(*) from airports",
"select foo from bar",
"select 1 + 1",
"explain select 1 + 1",
"explain query plan select 1 + 1",
"SELECT\nblah FROM foo",
"WITH RECURSIVE cnt(x) AS (SELECT 1 UNION ALL SELECT x+1 FROM cnt LIMIT 10) SELECT x FROM cnt;",
"explain WITH RECURSIVE cnt(x) AS (SELECT 1 UNION ALL SELECT x+1 FROM cnt LIMIT 10) SELECT x FROM cnt;",
"explain query plan WITH RECURSIVE cnt(x) AS (SELECT 1 UNION ALL SELECT x+1 FROM cnt LIMIT 10) SELECT x FROM cnt;",
],
)
def test_validate_sql_select_good(good_sql):

0 comments on commit fffd69e

Please sign in to comment.
You can’t perform that action at this time.