Skip to content

Commit

Permalink
fix encoding error in sql lab logging (#3424)
Browse files Browse the repository at this point in the history
  • Loading branch information
Grace Guo authored and mistercrunch committed Sep 14, 2017
1 parent 31b7b9a commit ad604ae
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
6 changes: 4 additions & 2 deletions superset/sql_lab.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import unicode_literals

from time import sleep
from datetime import datetime
import json
Expand Down Expand Up @@ -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 = {}
Expand Down
2 changes: 2 additions & 0 deletions superset/sql_parse.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import unicode_literals

import logging

import sqlparse
Expand Down
5 changes: 5 additions & 0 deletions tests/sql_parse_tests.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
Expand Down Expand Up @@ -27,6 +28,10 @@ def test_simple_select(self):
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"},
Expand Down

0 comments on commit ad604ae

Please sign in to comment.