From 1a4ed0ddf6572ac7f76225318d0fcb6f72ba433d Mon Sep 17 00:00:00 2001 From: M1ha Date: Wed, 23 Jan 2019 13:32:18 +0500 Subject: [PATCH] Trying to speed up getting objects from multiple databases --- src/django_clickhouse/clickhouse_models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/django_clickhouse/clickhouse_models.py b/src/django_clickhouse/clickhouse_models.py index ea61399..24c7ddb 100644 --- a/src/django_clickhouse/clickhouse_models.py +++ b/src/django_clickhouse/clickhouse_models.py @@ -161,7 +161,7 @@ class ClickHouseModel(with_metaclass(ClickHouseModelMeta, InfiModel)): # Selecting data from multiple databases should work faster in parallel, if connections are independent. objs = exec_multi_arg_func( - lambda db_alias: cls.get_sync_query_set(db_alias, pk_by_db[db_alias]), + lambda db_alias: list(cls.get_sync_query_set(db_alias, pk_by_db[db_alias])), pk_by_db.keys() ) return list(chain(*objs))