How to use the pg8000.core.Cursor function in pg8000

To help you get started, we’ve selected a few pg8000 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 mfenniak / pg8000 / tests / test_query.py View on Github external
def test_context_manager_class(self):
        self.assertTrue('__enter__' in pg8000.core.Cursor.__dict__)
        self.assertTrue('__exit__' in pg8000.core.Cursor.__dict__)

        with self.db.cursor() as cursor:
            cursor.execute('select 1')
github mfenniak / pg8000 / tests / test_query.py View on Github external
def test_context_manager_class(self):
        self.assertTrue('__enter__' in pg8000.core.Cursor.__dict__)
        self.assertTrue('__exit__' in pg8000.core.Cursor.__dict__)

        with self.db.cursor() as cursor:
            cursor.execute('select 1')
github dkratzert / StructureFinder / pg8000 / core.py View on Github external
self._c._flush()
                    self._c.handle_messages(self)
                    if not self.portal_suspended:
                        self._c.close_portal(self)
                try:
                    return self._cached_rows.popleft()
                except IndexError:
                    if self.ps is None:
                        raise ProgrammingError("A query hasn't been issued.")
                    elif len(self.ps['row_desc']) == 0:
                        raise ProgrammingError("no result set")
                    else:
                        raise StopIteration()

if PY2:
    Cursor.next = Cursor.__next__

# Message codes
NOTICE_RESPONSE = b("N")
AUTHENTICATION_REQUEST = b("R")
PARAMETER_STATUS = b("S")
BACKEND_KEY_DATA = b("K")
READY_FOR_QUERY = b("Z")
ROW_DESCRIPTION = b("T")
ERROR_RESPONSE = b("E")
DATA_ROW = b("D")
COMMAND_COMPLETE = b("C")
PARSE_COMPLETE = b("1")
BIND_COMPLETE = b("2")
CLOSE_COMPLETE = b("3")
PORTAL_SUSPENDED = b("s")
NO_DATA = b("n")
github dkratzert / StructureFinder / pg8000 / core.py View on Github external
def cursor(self):
        """Creates a :class:`Cursor` object bound to this
        connection.

        This function is part of the `DBAPI 2.0 specification
        `_.
        """
        return Cursor(self)
github mfenniak / pg8000 / pg8000 / core.py View on Github external
def cursor(self):
        """Creates a :class:`Cursor` object bound to this
        connection.

        This function is part of the `DBAPI 2.0 specification
        `_.
        """
        return Cursor(self)
github dkratzert / StructureFinder / pg8000 / __init__.py View on Github external
NUMBER = 1700
"""Numeric type oid"""

DATETIME = 1114
"""Timestamp type oid"""

ROWID = 26
"""ROWID type oid"""

__all__ = [
    Warning, Bytea, DataError, DatabaseError, connect, InterfaceError,
    ProgrammingError, Error, OperationalError, IntegrityError, InternalError,
    NotSupportedError, ArrayContentNotHomogenousError, ArrayContentEmptyError,
    ArrayDimensionsNotConsistentError, ArrayContentNotSupportedError, utc,
    Connection, Cursor, Binary, Date, DateFromTicks, Time, TimeFromTicks,
    Timestamp, TimestampFromTicks, BINARY, Interval]

"""Version string for pg8000.
github mfenniak / pg8000 / pg8000 / __init__.py View on Github external
NUMBER = 1700
"""Numeric type oid"""

DATETIME = 1114
"""Timestamp type oid"""

ROWID = 26
"""ROWID type oid"""

__all__ = [
    Warning, Bytea, DataError, DatabaseError, connect, InterfaceError,
    ProgrammingError, Error, OperationalError, IntegrityError, InternalError,
    NotSupportedError, ArrayContentNotHomogenousError,
    ArrayDimensionsNotConsistentError, ArrayContentNotSupportedError, utc,
    Connection, Cursor, Binary, Date, DateFromTicks, Time, TimeFromTicks,
    Timestamp, TimestampFromTicks, BINARY, Interval, PGEnum, PGJson, PGJsonb,
    PGTsvector, PGText, PGVarchar]

"""Version string for pg8000.