sqlalchemy.update.where.where.values

Here are the examples of the python api sqlalchemy.update.where.where.values taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Examples 7

Example 1

Project: monasca-api Source File: notifications_repository.py
    def __init__(self):

        super(NotificationsRepository, self).__init__()

        metadata = MetaData()
        self.nm = models.create_nm_model(metadata)

        nm = self.nm

        self._select_nm_count_name_query = (select([func.count()])
                                            .select_from(nm)
                                            .where(
                                                and_(nm.c.tenant_id == bindparam('b_tenant_id'),
                                                     nm.c.name == bindparam('b_name'))))

        self._select_nm_count_id_query = (select([func.count()])
                                          .select_from(nm)
                                          .where(
                                              and_(nm.c.tenant_id == bindparam('b_tenant_id'),
                                                   nm.c.id == bindparam('b_id'))))

        self._insert_nm_query = (insert(nm)
                                 .values(
                                     id=bindparam('b_id'),
                                     tenant_id=bindparam('b_tenant_id'),
                                     name=bindparam('b_name'),
                                     type=bindparam('b_type'),
                                     address=bindparam('b_address'),
                                     period=bindparam('b_period'),
                                     created_at=bindparam('b_created_at'),
                                     updated_at=bindparam('b_updated_at')))

        self._delete_nm_query = (delete(nm)
                                 .where(nm.c.tenant_id == bindparam('b_tenant_id'))
                                 .where(nm.c.id == bindparam('b_id')))

        self._update_nm_query = (update(nm)
                                 .where(nm.c.tenant_id == bindparam('b_tenant_id'))
                                 .where(nm.c.id == bindparam('b_id'))
                                 .values(
                                     name=bindparam('b_name'),
                                     type=bindparam('b_type'),
                                     address=bindparam('b_address'),
                                     period=bindparam('b_period'),
                                     updated_at=bindparam('b_updated_at')))

        self._select_nm_id_query = (select([nm])
                                    .where(
                                        and_(nm.c.tenant_id == bindparam('b_tenant_id'),
                                             nm.c.id == bindparam('b_id'))))

        self._select_nm_name_query = (select([nm])
                                      .where(
                                          and_(nm.c.tenant_id == bindparam('b_tenant_id'),
                                               nm.c.name == bindparam('b_name'))))