Skip to content

Commit

Permalink
Merge pull request apache#8 from timifasubaa/airbnb-master
Browse files Browse the repository at this point in the history
Cherry pick CSV hotfix and dashboard view
  • Loading branch information
Grace Guo authored Feb 6, 2018
2 parents 601fe7c + de69dde commit 64e886f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
3 changes: 1 addition & 2 deletions superset/db_engine_specs.py
Original file line number Diff line number Diff line change
Expand Up @@ -832,9 +832,8 @@ def get_column_names(filepath):
sql = """CREATE EXTERNAL TABLE {table_name} ( {schema_definition} )
ROW FORMAT DELIMITED FIELDS TERMINATED BY ',' STORED AS
TEXTFILE LOCATION '{location}'""".format(**locals())

logging.info(form.con.data)
engine = create_engine(form.con.data)
engine = create_engine(form.con.data.sqlalchemy_uri)
engine.execute(sql)

@classmethod
Expand Down
12 changes: 12 additions & 0 deletions superset/views/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,7 @@ class SliceAddView(SliceModelView): # noqa
list_columns = [
'id', 'slice_name', 'slice_link', 'viz_type',
'datasource_link', 'owners', 'modified', 'changed_on']
show_columns = list(set(SliceModelView.edit_columns + list_columns))


appbuilder.add_view_no_menu(SliceAddView)
Expand Down Expand Up @@ -619,6 +620,17 @@ class DashboardModelViewAsync(DashboardModelView): # noqa
appbuilder.add_view_no_menu(DashboardModelViewAsync)


class DashboardAddView(DashboardModelView): # noqa
list_columns = [
'id', 'dashboard_link', 'creator', 'modified', 'dashboard_title',
'changed_on', 'url', 'changed_by_name',
]
show_columns = list(set(DashboardModelView.edit_columns + list_columns))


appbuilder.add_view_no_menu(DashboardAddView)


class LogModelView(SupersetModelView):
datamodel = SQLAInterface(models.Log)
list_columns = ('user', 'action', 'dttm')
Expand Down
7 changes: 7 additions & 0 deletions tests/core_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,13 @@ def test_add_slice(self):
resp = self.client.get(url)
self.assertEqual(resp.status_code, 200)

def test_get_user_slices(self):
self.login(username='admin')
userid = appbuilder.sm.find_user('admin').id
url = '/sliceaddview/api/read?_flt_0_created_by={}'.format(userid)
resp = self.client.get(url)
self.assertEqual(resp.status_code, 200)

def test_slices_V2(self):
# Add explore-v2-beta role to admin user
# Test all slice urls as user with with explore-v2-beta role
Expand Down

0 comments on commit 64e886f

Please sign in to comment.