Skip to content
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
5 changes: 4 additions & 1 deletion caravel/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1007,6 +1007,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 @@ -1028,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 @@ -1382,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