superset-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From maximebeauche...@apache.org
Subject [incubator-superset] branch master updated: fix encoding error in sql lab logging (#3424)
Date Thu, 14 Sep 2017 18:18:36 GMT
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
     new ad604ae  fix encoding error in sql lab logging (#3424)
ad604ae is described below

commit ad604aed09eb362964503cc56d6749160ec77e80
Author: Grace Guo <grace.guo@airbnb.com>
AuthorDate: Thu Sep 14 11:18:34 2017 -0700

    fix encoding error in sql lab logging (#3424)
---
 superset/sql_lab.py      | 6 ++++--
 superset/sql_parse.py    | 2 ++
 tests/sql_parse_tests.py | 5 +++++
 3 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/superset/sql_lab.py b/superset/sql_lab.py
index 06954ad..0bfca71 100644
--- a/superset/sql_lab.py
+++ b/superset/sql_lab.py
@@ -1,3 +1,5 @@
+from __future__ import unicode_literals
+
 from time import sleep
 from datetime import datetime
 import json
@@ -34,8 +36,8 @@ def dedup(l, suffix='__'):
     Always returns the same number of entries as provided, and always returns
     unique values.
 
-    >>> dedup(['foo', 'bar', 'bar', 'bar'])
-    ['foo', 'bar', 'bar__1', 'bar__2']
+    >>> print(','.join(dedup(['foo', 'bar', 'bar', 'bar'])))
+    foo,bar,bar__1,bar__2
     """
     new_l = []
     seen = {}
diff --git a/superset/sql_parse.py b/superset/sql_parse.py
index 0faae28..d0bf5bb 100644
--- a/superset/sql_parse.py
+++ b/superset/sql_parse.py
@@ -1,3 +1,5 @@
+from __future__ import unicode_literals
+
 import logging
 
 import sqlparse
diff --git a/tests/sql_parse_tests.py b/tests/sql_parse_tests.py
index 284e168..c9cc389 100644
--- a/tests/sql_parse_tests.py
+++ b/tests/sql_parse_tests.py
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 from __future__ import absolute_import
 from __future__ import division
 from __future__ import print_function
@@ -27,6 +28,10 @@ class SupersetTestCase(unittest.TestCase):
         query = 'SELECT * FROM "tbname"'
         self.assertEquals({"tbname"}, self.extract_tables(query))
 
+        # unicode encoding
+        query = 'SELECT * FROM "tb_name" WHERE city = "L├╝beck"'
+        self.assertEquals({"tb_name"}, self.extract_tables(query))
+
         # schema
         self.assertEquals(
             {"schemaname.tbname"},

-- 
To stop receiving notification emails like this one, please contact
['"commits@superset.apache.org" <commits@superset.apache.org>'].

Mime
View raw message