From 9e127bd700f195b14e7b60aa6818d95299474e7e Mon Sep 17 00:00:00 2001 From: Benjamin Dauvergne Date: Sat, 18 Jun 2016 09:30:59 +0200 Subject: [PATCH] bijoe: add a count method to EngineCube --- bijoe/engine.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bijoe/engine.py b/bijoe/engine.py index 9b0c4d1..a36d995 100644 --- a/bijoe/engine.py +++ b/bijoe/engine.py @@ -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()