How to use the pg8000.errors.InternalError 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 / pg8000 / protocol.py View on Github external
def _invalid_state(self, state):
        raise errors.InternalError(
            "connection state must be %s, is %s" % (state, self._state))
github mfenniak / pg8000 / pg8000 / interface.py View on Github external
def _fill_cache(self):
        self._lock.acquire()
        try:
            if self._cached_rows:
                raise InternalError("attempt to fill cache that isn't empty")
            end_of_data, rows = self.c.fetch_rows(
                self._portal_name, self.row_cache_size, self._row_desc)
            self._cached_rows = rows
            if end_of_data:
                self._command_complete = True
        finally:
            self._lock.release()
github mfenniak / pg8000 / pg8000 / protocol.py View on Github external
def __init__(self, typ, name):
        if len(typ) != 1:
            raise errors.InternalError("Describe typ must be 1 char")
        self.typ = typ
        self.name = name
github amplab / benchmark / runner / prepare_benchmark.py View on Github external
def query_with_catch(cursor, query):
    try: 
      cursor.execute(query)
    except pg8000.errors.InternalError as e:
      print >> stderr, "Received error from pg8000: %s" % e
      print >> stderr, "Attempting to continue..."
github mfenniak / pg8000 / pg8000 / interface.py View on Github external
def _get_row_count(self):
        self._lock.acquire()
        try:
            if not self._command_complete:
                end_of_data, rows = self.c.fetch_rows(
                    self._portal_name, 0, self._row_desc)
                self._cached_rows += rows
                if end_of_data:
                    self._command_complete = True
                else:
                    raise InternalError(
                        "fetch_rows(0) did not hit end of data")
            return self._ongoing_row_count + len(self._cached_rows)
        finally:
            self._lock.release()