示例#1
0
 def connect(self, **kwargs):
     conn = yield from connect(db=self.db,
                               user=self.user,
                               password=self.password,
                               host=self.host,
                               loop=self.loop,
                               **kwargs)
     # TODO: fix this, should autocommit be enabled by default?
     yield from conn.autocommit(True)
     ret = sa.SAConnection(conn, sa.engine._dialect)
     return ret
示例#2
0
 def connect(self, **kwargs):
     conn = yield from connect(db='test_pymysql',
                               user='******',
                               password='',
                               host='127.0.0.1',
                               loop=self.loop,
                               **kwargs)
     # TODO: fix this, should autocommit be enabled by default?
     yield from conn.autocommit(True)
     ret = sa.SAConnection(conn, sa.engine._dialect)
     return ret
示例#3
0
 async def connect(**kwargs):
     conn = await connection_creator()
     await conn.autocommit(True)
     cur = await conn.cursor()
     await cur.execute("DROP TABLE IF EXISTS sa_test_type_tbl")
     await cur.execute("CREATE TABLE sa_test_type_tbl "
                       "(id serial, val bigint)")
     await cur._connection.commit()
     engine = mock.Mock()
     engine.dialect = sa.engine._dialect
     return sa.SAConnection(conn, engine)
示例#4
0
    async def _connect(**kwargs):
        conn = await connection_creator(**kwargs)
        # TODO: fix this, should autocommit be enabled by default?
        await conn.autocommit(True)
        engine = mock.Mock()
        engine.dialect = sa.engine._dialect

        def release(*args):
            return

        engine.release = release

        ret = sa.SAConnection(conn, engine)
        return ret
示例#5
0
    async def connect(**kwargs):
        conn = await connection_creator(**kwargs)
        await conn.autocommit(True)
        cur = await conn.cursor()
        await cur.execute("DROP TABLE IF EXISTS sa_tbl")
        await cur.execute("CREATE TABLE sa_tbl "
                          "(id serial, name varchar(255))")
        await cur.execute("INSERT INTO sa_tbl (name)" "VALUES ('first')")

        await cur._connection.commit()
        # yield from cur.close()
        engine = mock.Mock()
        engine.dialect = sa.engine._dialect
        return sa.SAConnection(conn, engine)
示例#6
0
    def connect(self, **kwargs):
        conn = yield from connect(db='test_pymysql',
                                  user='******',
                                  password='',
                                  host='127.0.0.1',
                                  loop=self.loop,
                                  **kwargs)
        yield from conn.autocommit(True)
        cur = conn.cursor()
        yield from cur.execute("DROP TABLE IF EXISTS sa_tbl")
        yield from cur.execute("CREATE TABLE sa_tbl "
                               "(id serial, name varchar(255))")
        yield from cur.execute("INSERT INTO sa_tbl (name)" "VALUES ('first')")

        yield from cur._connection.commit()
        # yield from cur.close()
        return sa.SAConnection(conn, sa.engine._dialect)
示例#7
0
 async def connect(self, **kwargs):
     conn = await connect(db=self.db,
                          user=self.user,
                          password=self.password,
                          host=self.host,
                          loop=self.loop,
                          port=self.port,
                          **kwargs)
     await conn.autocommit(True)
     cur = await conn.cursor()
     await cur.execute("DROP TABLE IF EXISTS sa_test_type_tbl")
     await cur.execute("CREATE TABLE sa_test_type_tbl "
                       "(id serial, val bigint)")
     await cur._connection.commit()
     engine = mock.Mock()
     engine.dialect = sa.engine._dialect
     return sa.SAConnection(conn, engine)
示例#8
0
    def connect(self, **kwargs):
        conn = yield from connect(db=self.db,
                                  user=self.user,
                                  password=self.password,
                                  host=self.host,
                                  loop=self.loop,
                                  **kwargs)
        yield from conn.autocommit(True)
        cur = yield from conn.cursor()
        yield from cur.execute("DROP TABLE IF EXISTS sa_tbl")
        yield from cur.execute("CREATE TABLE sa_tbl "
                               "(id serial, name varchar(255))")
        yield from cur.execute("INSERT INTO sa_tbl (name)" "VALUES ('first')")

        yield from cur._connection.commit()
        # yield from cur.close()
        engine = mock.Mock()
        engine.dialect = sa.engine._dialect
        return sa.SAConnection(conn, engine)
示例#9
0
    def connect(self, **kwargs):
        conn = yield from connect(db=self.db,
                                  user=self.user,
                                  password=self.password,
                                  host=self.host,
                                  loop=self.loop,
                                  **kwargs)
        # TODO: fix this, should autocommit be enabled by default?
        yield from conn.autocommit(True)
        engine = mock.Mock()
        engine.dialect = sa.engine._dialect

        def release(*args):
            return

        engine.release = release

        ret = sa.SAConnection(conn, engine)
        return ret