From 0106dda8b3b4e82bb60b76e0e4037a2aa0c66755 Mon Sep 17 00:00:00 2001 From: Praneeth Bedapudi Date: Mon, 30 Oct 2023 23:45:29 +0530 Subject: [PATCH] fix select_keys Signed-off-by: Praneeth Bedapudi --- liteindex/defined_index.py | 9 ++++----- setup.py | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/liteindex/defined_index.py b/liteindex/defined_index.py index 669922d..7d150d5 100644 --- a/liteindex/defined_index.py +++ b/liteindex/defined_index.py @@ -345,6 +345,8 @@ def search( if not select_keys: select_keys = list(self.original_key_to_key_hash) + select_keys_hashes = [self.original_key_to_key_hash[k] for k in select_keys] + sql_query, sql_params = search_query( table_name=self.name, query={self.original_key_to_key_hash[k]: v for k, v in query.items()}, @@ -354,10 +356,7 @@ def search( n=n, page=page_no, page_size=n if page_no else None, - select_columns=( - ["id", "updated_at"] - + [f'"{self.original_key_to_key_hash[k]}"' for k in select_keys] - ), + select_columns=(["id", "updated_at"] + select_keys_hashes), ) results = {} @@ -366,7 +365,7 @@ def search( _id, updated_at = result[:2] record = { self.key_hash_to_original_key[h]: val - for h, val in zip(self.original_key_to_key_hash.values(), result[2:]) + for h, val in zip(select_keys_hashes, result[2:]) } for k, v in record.items(): if v is None: diff --git a/setup.py b/setup.py index f0d9268..d13f280 100644 --- a/setup.py +++ b/setup.py @@ -18,7 +18,7 @@ EMAIL = "praneeth@bpraneeth.com" AUTHOR = "BEDAPUDI PRANEETH" REQUIRES_PYTHON = ">=3.6.0" -VERSION = "0.0.2.dev11" +VERSION = "0.0.2.dev12" # What packages are required for this module to be executed? REQUIRED = [