Skip to content

Commit

Permalink
Attempting to fix #412 (#430)
Browse files Browse the repository at this point in the history
* Attempting to fix #412

* More flushes
  • Loading branch information
mistercrunch committed May 10, 2016
1 parent d79089c commit 673cce9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion caravel/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1030,6 +1030,7 @@ def sync_to_db(cls, name, cluster):
flasher("Adding new datasource [{}]".format(name), "success")
else:
flasher("Refreshing datasource [{}]".format(name), "info")
session.flush()
datasource.cluster = cluster

cols = datasource.latest_metadata()
Expand All @@ -1051,8 +1052,10 @@ def sync_to_db(cls, name, cluster):
col_obj.filterable = True
if col_obj:
col_obj.type = cols[col]['type']
session.flush()
col_obj.datasource = datasource
col_obj.generate_metrics()
session.flush()

def query( # druid
self, groupby, metrics,
Expand Down Expand Up @@ -1415,7 +1418,7 @@ def generate_metrics(self):
metric.datasource_name = self.datasource_name
if not m:
session.add(metric)
session.commit()
session.flush()


class FavStar(Model):
Expand Down

0 comments on commit 673cce9

Please sign in to comment.