Skip to content

Commit

Permalink
Adding more metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
mistercrunch committed Aug 1, 2017
1 parent 7dd1e23 commit 9882748
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ export default class DatasourceControl extends React.PureComponent {
success: (data) => {
const datasources = data.map(ds => ({
rawName: ds.name,
connection: ds.connection,
schema: ds.schema,
name: (
<a
href="#"
Expand Down Expand Up @@ -136,11 +138,11 @@ export default class DatasourceControl extends React.PureComponent {
}
{this.state.datasources &&
<Table
columns={['name', 'type']}
columns={['name', 'type', 'schema', 'connection', 'creator']}
className="table table-condensed"
data={this.state.datasources}
itemsPerPage={20}
filterable={['rawName', 'type']}
filterable={['rawName', 'type', 'connection', 'schema', 'creator']}
filterBy={this.state.filter}
hideFilterInput
/>
Expand Down
13 changes: 13 additions & 0 deletions superset/connectors/base/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,16 @@ def column_names(self):
def main_dttm_col(self):
return "timestamp"

@property
def connection(self):
"""String representing the context of the Datasource"""
return None

@property
def schema(self):
"""String representing the schema of the Datasource (if it applies)"""
return None

@property
def groupby_column_names(self):
return sorted([c.column_name for c in self.columns if c.groupby])
Expand Down Expand Up @@ -114,8 +124,11 @@ def short_data(self):
'edit_url': self.url,
'id': self.id,
'uid': self.uid,
'schema': self.schema,
'name': self.name,
'type': self.type,
'connection': self.connection,
'creator': str(self.created_by),
}

@property
Expand Down
4 changes: 4 additions & 0 deletions superset/connectors/druid/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,10 @@ class DruidDatasource(Model, BaseDatasource):
def database(self):
return self.cluster

@property
def connection(self):
return str(self.database)

@property
def num_cols(self):
return [c.column_name for c in self.columns if c.is_num]
Expand Down
4 changes: 4 additions & 0 deletions superset/connectors/sqla/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,10 @@ class SqlaTable(Model, BaseDatasource):
def __repr__(self):
return self.name

@property
def connection(self):
return str(self.database)

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

0 comments on commit 9882748

Please sign in to comment.