def get_query_for_ids(modelquery, model, ids):
 if has_multiple_pks(model):
  decoded_ids = [iterdecode(v) for v in ids]
  model_pk = [getattr(model, name) for name in get_primary_key(model)]
  try:
   query = modelquery.filter(tuple_(*model_pk).in_(decoded_ids))
   query.all()
  except DBAPIError:
   query = modelquery.filter(tuple_operator_in(model_pk, decoded_ids))
 else:
  model_pk = getattr(model, get_primary_key(model))
  query = modelquery.filter(model_pk.in_(ids))
 return query

def get_query_for_ids ( modelquery , model , ids ) : if has_multiple_pks ( model ) : decoded_ids = [ iterdecode ( v ) for v in ids ] model_pk = [ getattr ( model , name ) for name in get_primary_key ( model ) ] try : query = modelquery . filter ( tuple_ ( * model_pk ) . in_ ( decoded_ids ) ) query . all ( ) except DBAPIError : query = modelquery . filter ( tuple_operator_in ( model_pk , decoded_ids ) ) else : model_pk = getattr ( model , get_primary_key ( model ) ) query = modelquery . filter ( model_pk . in_ ( ids ) ) return query
return a query object filtered by primary key values passed in ids argument .