def get_workflow(id):
    return session.query(Workflow).get(id)

def get_action(name):
    return session.query(Action).filter_by(name=name).one()
SQLAlchemy: Relation table with composite primary key