From 9aa22e1071b01d420d034d4efbc3bbcc90efbd65 Mon Sep 17 00:00:00 2001 From: Lex Berezhny Date: Mon, 8 Oct 2018 10:37:52 -0400 Subject: [PATCH] sql: pop offset/limit/order_by when doing simple count(*) query --- torba/basedatabase.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/torba/basedatabase.py b/torba/basedatabase.py index b05c15fae..637706adc 100644 --- a/torba/basedatabase.py +++ b/torba/basedatabase.py @@ -362,6 +362,9 @@ class BaseDatabase(SQLiteMixin): @defer.inlineCallbacks def get_transaction_count(self, **constraints): + constraints.pop('offset', None) + constraints.pop('limit', None) + constraints.pop('order_by', None) count = yield self.select_transactions('count(*)', **constraints) return count[0][0] @@ -398,6 +401,9 @@ class BaseDatabase(SQLiteMixin): @defer.inlineCallbacks def get_txo_count(self, **constraints): + constraints.pop('offset', None) + constraints.pop('limit', None) + constraints.pop('order_by', None) count = yield self.select_txos('count(*)', **constraints) return count[0][0]