Skip to content

Commit

Permalink
handle null column_name in sqla and druid models
Browse files Browse the repository at this point in the history
  • Loading branch information
Grace Guo committed Mar 23, 2019
1 parent c7ffdd6 commit 9857d04
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions superset/connectors/base/models.py
Expand Up @@ -86,7 +86,7 @@ def uid(self):

@property
def column_names(self):
return sorted([c.column_name for c in self.columns])
return sorted([c.column_name for c in self.columns], key=lambda x: x or '')

@property
def columns_types(self):
Expand Down Expand Up @@ -166,7 +166,9 @@ def select_star(self):
def data(self):
"""Data representation of the datasource sent to the frontend"""
order_by_choices = []
for s in sorted(self.column_names):
# self.column_names return sorted column_names
for s in self.column_names:
s = str(s or '')
order_by_choices.append((json.dumps([s, True]), s + ' [asc]'))
order_by_choices.append((json.dumps([s, False]), s + ' [desc]'))

Expand Down
2 changes: 1 addition & 1 deletion superset/connectors/druid/models.py
Expand Up @@ -280,7 +280,7 @@ class DruidColumn(Model, BaseColumn):
export_parent = 'datasource'

def __repr__(self):
return self.column_name
return self.column_name or str(self.id)

@property
def expression(self):
Expand Down

0 comments on commit 9857d04

Please sign in to comment.