Display full table name (schema + name) if possible. (#1728)

This commit is contained in:
Bogdan 2016-12-01 14:57:39 -05:00 committed by GitHub
parent 7f4f250970
commit 1a16491971
2 changed files with 9 additions and 6 deletions

View File

@ -435,7 +435,8 @@ class Dashboard(Model, AuditMixinNullable, ImportMixin):
@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):
@ -896,7 +897,7 @@ 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):
@ -904,9 +905,9 @@ class SqlaTable(Model, Queryable, AuditMixinNullable, ImportMixin):
@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):
@ -920,7 +921,9 @@ class SqlaTable(Model, Queryable, AuditMixinNullable, ImportMixin):
@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):

View File

@ -701,7 +701,7 @@ class TableModelView(SupersetModelView, DeleteMixin): # noqa
"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()