You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by gr...@apache.org on 2019/03/22 00:56:50 UTC

[incubator-superset] branch 0.30 created (now 93ded8d)

This is an automated email from the ASF dual-hosted git repository.

graceguo pushed a change to branch 0.30
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git.


      at 93ded8d  0.30rc13

This branch includes the following new commits:

     new d1952b8  [csv-upload] Fixing message encoding (#6971)
     new c4238c3  [sql-parse] Fixing LIMIT exceptions (#6963)
     new 93ded8d  0.30rc13

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[incubator-superset] 01/03: [csv-upload] Fixing message encoding (#6971)

Posted by gr...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

graceguo pushed a commit to branch 0.30
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git

commit d1952b8d047cabecab11dab9f3eef730d19b2a05
Author: John Bodley <45...@users.noreply.github.com>
AuthorDate: Sun Mar 3 15:27:08 2019 -0800

    [csv-upload] Fixing message encoding (#6971)
    
    
    (cherry picked from commit 48431ab5b9375a94c5262a0336d9c69e5f01a3ac)
---
 superset/views/core.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/superset/views/core.py b/superset/views/core.py
index a15d724..821eb9d 100755
--- a/superset/views/core.py
+++ b/superset/views/core.py
@@ -362,7 +362,7 @@ class CsvToDatabaseView(SimpleFormView):
             except OSError:
                 pass
             message = 'Table name {} already exists. Please pick another'.format(
-                form.name.data) if isinstance(e, IntegrityError) else e
+                form.name.data) if isinstance(e, IntegrityError) else str(e)
             flash(
                 message,
                 'danger')


[incubator-superset] 02/03: [sql-parse] Fixing LIMIT exceptions (#6963)

Posted by gr...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

graceguo pushed a commit to branch 0.30
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git

commit c4238c3f6fa58273735a9ecf5d70f2606b9c9571
Author: John Bodley <45...@users.noreply.github.com>
AuthorDate: Tue Mar 5 09:36:08 2019 -0800

    [sql-parse] Fixing LIMIT exceptions (#6963)
    
    
    (cherry picked from commit 3e076cb60b385e675ed1c9a8053493375e43370b)
---
 superset/sql_parse.py         | 19 ++++++++-----------
 tests/db_engine_specs_test.py | 14 ++++++++++++++
 2 files changed, 22 insertions(+), 11 deletions(-)

diff --git a/superset/sql_parse.py b/superset/sql_parse.py
index 80dba4c..dc6d3df 100644
--- a/superset/sql_parse.py
+++ b/superset/sql_parse.py
@@ -138,18 +138,15 @@ class SupersetQuery(object):
                     if self.__is_identifier(token):
                         self.__process_identifier(token)
 
-    def _get_limit_from_token(self, token):
-        if token.ttype == sqlparse.tokens.Literal.Number.Integer:
-            return int(token.value)
-        elif token.is_group:
-            return int(token.get_token_at_offset(1).value)
-
     def _extract_limit_from_query(self, statement):
-        limit_token = None
-        for pos, item in enumerate(statement.tokens):
-            if item.ttype in Keyword and item.value.lower() == 'limit':
-                limit_token = statement.tokens[pos + 2]
-                return self._get_limit_from_token(limit_token)
+        idx, _ = statement.token_next_by(m=(Keyword, 'LIMIT'))
+        if idx is not None:
+            _, token = statement.token_next(idx=idx)
+            if token:
+                if isinstance(token, IdentifierList):
+                    _, token = token.token_next(idx=-1)
+                if token and token.ttype == sqlparse.tokens.Literal.Number.Integer:
+                    return int(token.value)
 
     def get_query_with_new_limit(self, new_limit):
         """returns the query with the specified limit"""
diff --git a/tests/db_engine_specs_test.py b/tests/db_engine_specs_test.py
index bdee22a..2c24063 100644
--- a/tests/db_engine_specs_test.py
+++ b/tests/db_engine_specs_test.py
@@ -125,12 +125,26 @@ class DbEngineSpecsTestCase(SupersetTestCase):
         q2 = 'select * from (select * from my_subquery limit 10) where col=1 limit 20'
         q3 = 'select * from (select * from my_subquery limit 10);'
         q4 = 'select * from (select * from my_subquery limit 10) where col=1 limit 20;'
+        q5 = 'select * from mytable limit 10, 20'
+        q6 = 'select * from mytable limit 10 offset 20'
+        q7 = 'select * from mytable limit'
+        q8 = 'select * from mytable limit 10.0'
+        q9 = 'select * from mytable limit x'
+        q10 = 'select * from mytable limit x, 20'
+        q11 = 'select * from mytable limit x offset 20'
 
         self.assertEqual(engine_spec_class.get_limit_from_sql(q0), None)
         self.assertEqual(engine_spec_class.get_limit_from_sql(q1), 10)
         self.assertEqual(engine_spec_class.get_limit_from_sql(q2), 20)
         self.assertEqual(engine_spec_class.get_limit_from_sql(q3), None)
         self.assertEqual(engine_spec_class.get_limit_from_sql(q4), 20)
+        self.assertEqual(engine_spec_class.get_limit_from_sql(q5), 10)
+        self.assertEqual(engine_spec_class.get_limit_from_sql(q6), 10)
+        self.assertEqual(engine_spec_class.get_limit_from_sql(q7), None)
+        self.assertEqual(engine_spec_class.get_limit_from_sql(q8), None)
+        self.assertEqual(engine_spec_class.get_limit_from_sql(q9), None)
+        self.assertEqual(engine_spec_class.get_limit_from_sql(q10), None)
+        self.assertEqual(engine_spec_class.get_limit_from_sql(q11), None)
 
     def test_wrapped_query(self):
         self.sql_limit_regex(


[incubator-superset] 03/03: 0.30rc13

Posted by gr...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

graceguo pushed a commit to branch 0.30
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git

commit 93ded8df9d23dde3e98381f550d00c3f1020f204
Author: John Bodley <jo...@airbnb.com>
AuthorDate: Wed Mar 6 11:23:11 2019 -0800

    0.30rc13
---
 superset/assets/package.json | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/superset/assets/package.json b/superset/assets/package.json
index 16216d9..b298ffe 100644
--- a/superset/assets/package.json
+++ b/superset/assets/package.json
@@ -1,6 +1,6 @@
 {
   "name": "superset",
-  "version": "0.30.0rc12",
+  "version": "0.30.0rc13",
   "description": "Superset is a data exploration platform designed to be visual, intuitive, and interactive.",
   "license": "Apache-2.0",
   "directories": {