Ejemplo n.º 1
0
        def test_limit_render_multiple_times(self, connection):
            table = self.tables.some_table
            stmt = select(table.c.id).order_by(table.c.id).limit(1).scalar_subquery()

            u = sqlalchemy.union(select(stmt), select(stmt)).subquery().select()

            self._assert_result(
                connection, u, [(1,)],
            )
Ejemplo n.º 2
0
 def test_select_exists_false(self, connection):
     stuff = self.tables.stuff
     eq_(
         connection.execute(
             select([stuff.c.id]).where(exists().where(stuff.c.data == "no data"))
         ).fetchall(),
         [],
     )
Ejemplo n.º 3
0
 def test_select_exists(self, connection):
     stuff = self.tables.stuff
     eq_(
         connection.execute(
             select([stuff.c.id]).where(
                 and_(stuff.c.id == 1, exists().where(stuff.c.data == "some data"),)
             )
         ).fetchall(),
         [(1,)],
     )
Ejemplo n.º 4
0
    def test_round_trip_executemany(self, connection):
        unicode_table = self.tables.unicode_table
        connection.execute(
            unicode_table.insert(),
            [{"id": i, "unicode_data": self.data} for i in range(3)],
        )

        rows = connection.execute(select(unicode_table.c.unicode_data)).fetchall()
        eq_(rows, [(self.data,) for i in range(3)])
        for row in rows:
            assert isinstance(row[0], util.text_type)