python - IN Query not working for Amazon DynamoDB -
i check retrieve items have attribute value present in list of value provide. below query have searching. unfortunately response return empty list of items. don't understand why case , know correct query.
def search(self, src_words, translations): entries = [] query_src_words = [word.decode("utf-8") word in src_words] params = { "tablename": self.table, "filterexpression": "src_word in (:src_words) , src_language = :src_language , target_language = :target_language", "expressionattributevalues": { ":src_words": {"ss": query_src_words}, ":src_language": {"s": config["source_language"]}, ":target_language": {"s": config["target_language"]} } } page_iterator = self.paginator.paginate(**params) page in page_iterator: entry in page["items"]: entries.append(entry) return entries
below table query from. example if list of query_src_word
have: [soccer ball, dog]
row entry_id=2
should returned
any insights appreciated.
i think because in query_src_word have "soccer_ball" (with underscore), while in database have "soccer ball" (without underscore).
change "soccer_ball" "soccer ball" in query_src_words , should work find
Comments
Post a Comment