mirror of
https://github.com/valitydev/redash.git
synced 2024-11-07 01:25:16 +00:00
Handling whitespace characters in Query Results data source
This commit is contained in:
parent
8e8278d05e
commit
93aa28cdf7
@ -43,7 +43,7 @@ def _guess_type(value):
|
||||
|
||||
|
||||
def extract_query_ids(query):
|
||||
queries = re.findall(r'(?:join|from) query_(\d+)', query, re.IGNORECASE)
|
||||
queries = re.findall(r'(?:join|from)\s+query_(\d+)', query, re.IGNORECASE)
|
||||
return [int(q) for q in queries]
|
||||
|
||||
|
||||
|
@ -19,6 +19,10 @@ class TestExtractQueryIds(TestCase):
|
||||
query = "SELECT * FROM query_123 JOIN query_4566"
|
||||
self.assertEquals([123, 4566], extract_query_ids(query))
|
||||
|
||||
def test_finds_queries_with_whitespace_characters(self):
|
||||
query = "SELECT * FROM query_123 a JOIN\tquery_4566 b ON a.id=b.parent_id JOIN\r\nquery_78 c ON b.id=c.parent_id"
|
||||
self.assertEquals([123, 4566, 78], extract_query_ids(query))
|
||||
|
||||
|
||||
class TestCreateTable(TestCase):
|
||||
def test_creates_table_with_colons_in_column_name(self):
|
||||
|
Loading…
Reference in New Issue
Block a user