Skip to content

Commit

Permalink
fix select_keys
Browse files Browse the repository at this point in the history
Signed-off-by: Praneeth Bedapudi <praneeth@bpraneeth.com>
  • Loading branch information
bedapudi6788 committed Oct 30, 2023
1 parent 58096f1 commit 0106dda
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
9 changes: 4 additions & 5 deletions liteindex/defined_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()},
Expand All @@ -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 = {}
Expand All @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down

0 comments on commit 0106dda

Please sign in to comment.