Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #529 1 "This Session's transaction has been rolled back" #530

Merged
merged 2 commits into from
Jun 1, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions caravel/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,13 +317,14 @@ class TableModelView(CaravelModelView, DeleteMixin): # noqa
}

def post_add(self, table):
table_name = table.table_name
try:
table.fetch_metadata()
except Exception as e:
logging.exception(e)
flash(
"Table [{}] doesn't seem to exist, "
"couldn't fetch metadata".format(table.table_name),
"couldn't fetch metadata".format(table_name),
"danger")
utils.merge_perm(sm, 'datasource_access', table.perm)

Expand Down Expand Up @@ -1001,12 +1002,13 @@ def refresh_datasources(self):
"""endpoint that refreshes druid datasources metadata"""
session = db.session()
for cluster in session.query(models.DruidCluster).all():
cluster_name = cluster.cluster_name
try:
cluster.refresh_datasources()
except Exception as e:
flash(
"Error while processing cluster '{}'\n{}".format(
cluster, str(e)),
cluster_name, str(e)),
"danger")
logging.exception(e)
return redirect('/druidclustermodelview/list/')
Expand Down