Skip to content

Commit

Permalink
More flushes
Browse files Browse the repository at this point in the history
  • Loading branch information
mistercrunch committed May 10, 2016
1 parent 2ec0d49 commit 99deb49
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions caravel/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1007,8 +1007,8 @@ def sync_to_db(cls, name, cluster):
flasher("Adding new datasource [{}]".format(name), "success")
else:
flasher("Refreshing datasource [{}]".format(name), "info")
datasource.cluster = cluster
session.flush()
datasource.cluster = cluster

cols = datasource.latest_metadata()
if not cols:
Expand All @@ -1029,8 +1029,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 @@ -1383,7 +1385,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 99deb49

Please sign in to comment.