From dd7aff8136836268bd8e8c90cd1d55e8e582d000 Mon Sep 17 00:00:00 2001 From: Michele Comitini Date: Tue, 9 Jul 2013 09:07:37 +0200 Subject: [PATCH] speedup in case of keyed tables --- gluon/dal.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/gluon/dal.py b/gluon/dal.py index f2592868..ed9f4d5e 100644 --- a/gluon/dal.py +++ b/gluon/dal.py @@ -8386,10 +8386,7 @@ class Table(object): elif isinstance(key, dict): """ for keyed table """ query = self._build_query(key) - rows = self._db(query).select() - if rows: - return rows[0] - return None + return self._db(query).select(limitby=(0,1), orderby_on_limitby=False).first() elif str(key).isdigit() or 'google' in DRIVERS and isinstance(key, Key): return self._db(self._id == key).select(limitby=(0,1), orderby_on_limitby=False).first() elif key: