def batch_get()

in modular_sdk/models/pynamodb_extension/pynamodb_to_pymongo_adapter.py [0:0]


    def batch_get(self, model_class, items, attributes_to_get=None):
        collection = self._collection_from_model(model_class)
        query_params = []
        hash_key_name, range_key_name = self.__get_table_keys(model_class)
        if isinstance(items[0], tuple):
            query_params.append({'$or': [{hash_key_name: item[0],
                                          range_key_name: item[1]}
                                         for item in items]})
        else:
            query_params.append(
                {'$or': [{hash_key_name: item} for item in items]})
        raw_items = collection.find(*query_params)
        return [model_class.from_json(
            model_json=self.mongodb.decode_keys(item),
            attributes_to_get=attributes_to_get)
            for item in raw_items]