From d7a26a81bb7a96588e53c2b7c8cba116072722ee Mon Sep 17 00:00:00 2001 From: Kobi Tal Date: Tue, 29 Nov 2022 15:06:44 +0200 Subject: [PATCH] Fix pagination for models with alias fields --- src/infi/clickhouse_orm/database.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/infi/clickhouse_orm/database.py b/src/infi/clickhouse_orm/database.py index 703e982..bf47431 100644 --- a/src/infi/clickhouse_orm/database.py +++ b/src/infi/clickhouse_orm/database.py @@ -319,7 +319,8 @@ class Database(object): elif page_num < 1: raise ValueError('Invalid page number: %d' % page_num) offset = (page_num - 1) * page_size - query = 'SELECT * FROM $table' + query = 'SELECT {} FROM $table'.format(", ".join(model_class.fields().keys())) + if conditions: if isinstance(conditions, Q): conditions = conditions.to_sql(model_class)