def _activities_from_user_query(user_id):
    """Return an SQLAlchemy query for all activities from user_id."""
    import ckan.model as model
    q = model.Session.query(model.Activity)
    q = q.filter(model.Activity.user_id == user_id)
    return q
