How to use the aiopg.transaction.IsolationLevel function in aiopg

To help you get started, we’ve selected a few aiopg examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github aio-libs / aiopg / examples / transaction.py View on Github external
async def main():
    async with aiopg.create_pool(dsn) as pool:
        async with pool.acquire() as conn:
            async with conn.cursor() as cur:
                await cur.execute('CREATE TABLE tbl (id int)')
                await transaction(cur, IsolationLevel.repeatable_read)
                await transaction(cur, IsolationLevel.read_committed)
                await transaction(cur, IsolationLevel.serializable)

                await cur.execute('select * from tbl')
github aio-libs / aiopg / examples / transaction_oldsyle.py View on Github external
async def main():
    pool = await aiopg.create_pool(dsn)
    async with pool.cursor() as cur:
        await transaction(cur, IsolationLevel.repeatable_read)
        await transaction(cur, IsolationLevel.read_committed)
        await transaction(cur, IsolationLevel.serializable)

        cur.execute('select * from tbl')
github aio-libs / aiopg / examples / transaction.py View on Github external
async def main():
    async with aiopg.create_pool(dsn) as pool:
        async with pool.acquire() as conn:
            async with conn.cursor() as cur:
                await cur.execute('CREATE TABLE tbl (id int)')
                await transaction(cur, IsolationLevel.repeatable_read)
                await transaction(cur, IsolationLevel.read_committed)
                await transaction(cur, IsolationLevel.serializable)

                await cur.execute('select * from tbl')
github aio-libs / aiopg / aiopg / cursor.py View on Github external
def __init__(self, conn, impl, timeout, echo):
        self._conn = conn
        self._impl = impl
        self._timeout = timeout
        self._echo = echo
        self._transaction = Transaction(self, IsolationLevel.repeatable_read)
github aio-libs / aiopg / examples / transaction_oldsyle.py View on Github external
async def main():
    pool = await aiopg.create_pool(dsn)
    async with pool.cursor() as cur:
        await transaction(cur, IsolationLevel.repeatable_read)
        await transaction(cur, IsolationLevel.read_committed)
        await transaction(cur, IsolationLevel.serializable)

        cur.execute('select * from tbl')
github aio-libs / aiopg / aiopg / __init__.py View on Github external
levels = {'c': 'candidate',
                  'a': 'alpha',
                  'b': 'beta',
                  None: 'final'}
        releaselevel = levels[match.group('releaselevel')]
        serial = int(match.group('serial')) if match.group('serial') else 0
        return VersionInfo(major, minor, micro, releaselevel, serial)
    except Exception:
        raise ImportError("Invalid package version {}".format(ver))


version_info = _parse_version(__version__)

# make pyflakes happy
(connect, create_pool, Connection, Cursor, Pool, DEFAULT_TIMEOUT,
 IsolationLevel, Transaction)