示例#1
0
    def create(employee):
        new_employee = insert(Employees) \
            .values(dict(
            id=employee['id'],
            slack_handle=employee['name'],
            name=employee['profile']['real_name']
        ))

        execute = Session.execute(new_employee)
        Session.commit()
        return execute
示例#2
0
    def create(channel):
        new_channel = insert(Channels) \
            .values(dict(
            id=channel['id'],
            name=channel['name'],
            channel_created=channel['created']
        ))

        execute = Session.execute(new_channel)
        Session.commit()
        return execute
示例#3
0
    def toggle(slack_id, toggle):
        Session.query(Employees) \
            .filter(Employees.id == slack_id) \
            .update({'enabled': toggle})

        return Session.commit()