From 3820f368a14bc25dd10f3eab2270778b49df6bed Mon Sep 17 00:00:00 2001 From: Timm Fitschen <t.fitschen@indiscale.com> Date: Fri, 22 Sep 2023 12:20:33 +0200 Subject: [PATCH] MAINT: minor refactoring of Query.execute (detect count query) --- src/caosdb/common/models.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/caosdb/common/models.py b/src/caosdb/common/models.py index f8171a40..ee478c4a 100644 --- a/src/caosdb/common/models.py +++ b/src/caosdb/common/models.py @@ -4421,7 +4421,7 @@ class Query(): query_dict["query"] = str(self.q) has_paging = False - is_count_query = self.q.lower().startswith('count') + is_count_query = self.q.split()[0].lower() == "count" if len(self.q.split()) > 0 else False if not unique and not is_count_query and page_length is not None and page_length > 0: has_paging = True @@ -4434,9 +4434,7 @@ class Query(): self.cached = cresp.query.cached self.etag = cresp.query.etag - if is_count_query and len(cresp) == 0: - # this was a count query - + if is_count_query: return self.results if raise_exception_on_error: -- GitLab