def _activities_union_all(*qlist):
 import ckan.model as model
 return model.Session.query(model.Activity).select_entity_from(union_all(*[q.subquery().select() for q in qlist])).distinct(model.Activity.timestamp)

def _activities_union_all ( * qlist ) : import ckan . model as model return model . Session . query ( model . Activity ) . select_entity_from ( union_all ( * [ q . subquery ( ) . select ( ) for q in qlist ] ) ) . distinct ( model . Activity . timestamp )
return union of two or more queries sorted by timestamp .