Skip to content

Commit

Permalink
Display full table name (schema + name) if possible. (#1728)
Browse files Browse the repository at this point in the history
  • Loading branch information
bkyryliuk authored Dec 1, 2016
1 parent 7f4f250 commit 1a16491
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
13 changes: 8 additions & 5 deletions superset/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,8 @@ def __repr__(self):

@property
def table_names(self):
return ", ".join({"{}".format(s.datasource) for s in self.slices})
return ", ".join(
{"{}".format(s.datasource.name) for s in self.slices})

@property
def url(self):
Expand Down Expand Up @@ -896,17 +897,17 @@ class SqlaTable(Model, Queryable, AuditMixinNullable, ImportMixin):
name='_customer_location_uc'),)

def __repr__(self):
return self.table_name
return self.name

@property
def description_markeddown(self):
return utils.markdown(self.description)

@property
def link(self):
table_name = escape(self.table_name)
name = escape(self.name)
return Markup(
'<a href="{self.explore_url}">{table_name}</a>'.format(**locals()))
'<a href="{self.explore_url}">{name}</a>'.format(**locals()))

@property
def schema_perm(self):
Expand All @@ -920,7 +921,9 @@ def get_perm(self):

@property
def name(self):
return self.table_name
if not self.schema:
return self.table_name
return "{}.{}".format(self.schema, self.table_name)

@property
def full_name(self):
Expand Down
2 changes: 1 addition & 1 deletion superset/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,7 @@ def pre_add(self, table):
"Table [{}] could not be found, "
"please double check your "
"database connection, schema, and "
"table name".format(table.table_name))
"table name".format(table.name))

def post_add(self, table):
table.fetch_metadata()
Expand Down

0 comments on commit 1a16491

Please sign in to comment.