bijoe: add a count method to EngineCube

This commit is contained in:
Benjamin Dauvergne 2016-06-18 09:30:59 +02:00
parent cf539e86a7
commit 9e127bd700
1 changed files with 5 additions and 0 deletions

View File

@ -89,6 +89,11 @@ class EngineCube(object):
def __getattr__(self, name):
return getattr(self.cube, name)
def count(self):
cursor = self.engine.get_cursor()
cursor.execute('SELECT count(%s) FROM %s' % (self.key, self.fact_table))
return cursor.fetchone()[0]
def sql_query(self, filters, drilldown, measures, **kwargs):
cursor = self.engine.get_cursor()