Skip to content

Commit

Permalink
Merge pull request #20 from AnswerDotAI/fix-contains-on-tuple-pks
Browse files Browse the repository at this point in the history
Fix `__contains__` on tuple pk searches
  • Loading branch information
jph00 authored Aug 21, 2024
2 parents 2dc931d + 022625f commit d8f4102
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fastlite/kw.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def get(self:Table, pk_values: list|tuple|str|int, as_cls:bool=True)->Any:
if not isinstance(pk_values, (list, tuple)): pk_values = [pk_values]
last_pk = pk_values[0] if len(self.pks) == 1 else pk_values
xtra = getattr(self, 'xtra_id', {})
vals = pk_values + list(xtra.values())
vals = list(pk_values) + list(xtra.values())
pks = self.pks + list(xtra.keys())
if len(pks)!=len(vals): raise NotFoundError(f"Need {len(pks)} pk")
wheres = ["[{}] = ?".format(pk_name) for pk_name in pks]
Expand Down

0 comments on commit d8f4102

Please sign in to comment.