How to use the pymapd.exceptions.DatabaseError function in pymapd

To help you get started, we’ve selected a few pymapd 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 omnisci / pymapd / tests / test_exceptions.py View on Github external
def test_nonexistant_table_raises(self, nonexistant_table):
        result = _translate_exception(nonexistant_table)
        assert isinstance(result, DatabaseError)
        assert "Exception occurred: Table" in result.args[0]
github omnisci / pymapd / pymapd / exceptions.py View on Github external
class IntegrityError(DatabaseError):
    """Raised when the relational integrity of the database is affected."""


class InternalError(DatabaseError):
    """Raised for errors internal to the database, e.g. and invalid cursor."""


class ProgrammingError(DatabaseError):
    """Raised for programming errors, e.g. syntax errors, table already
    exists.
    """


class NotSupportedError(DatabaseError):
    """Raised when an API not supported by the database is used."""


def _translate_exception(e):
    # type: (Exception) -> Exception
    """Translate a thrift-land exception to a DB-API 2.0
    exception.
    """
    # TODO: see if there's a way to get error codes, rather than relying msgs
    if not isinstance(e, TMapDException):
        return e
    if 'Validate failed' in e.error_msg or 'Parse failed' in e.error_msg:
        err = ProgrammingError
    elif 'Exception occurred' in e.error_msg:
        err = DatabaseError
    else:
github omnisci / pymapd / pymapd / exceptions.py View on Github external
"""Base class for all pymapd errors."""


class InterfaceError(Error):
    """Raised whenever you use pymapd interface incorrectly."""


class DatabaseError(Error):
    """Raised when the database encounters an error."""


class DataError(DatabaseError):
    """Raised for data processing errors like division by zero, etc."""


class OperationalError(DatabaseError):
    """Raised for non-programmer related database errors, e.g.
    an unexpected disconnect.
    """


class IntegrityError(DatabaseError):
    """Raised when the relational integrity of the database is affected."""


class InternalError(DatabaseError):
    """Raised for errors internal to the database, e.g. and invalid cursor."""


class ProgrammingError(DatabaseError):
    """Raised for programming errors, e.g. syntax errors, table already
    exists.
github omnisci / pymapd / pymapd / exceptions.py View on Github external
class OperationalError(DatabaseError):
    """Raised for non-programmer related database errors, e.g.
    an unexpected disconnect.
    """


class IntegrityError(DatabaseError):
    """Raised when the relational integrity of the database is affected."""


class InternalError(DatabaseError):
    """Raised for errors internal to the database, e.g. and invalid cursor."""


class ProgrammingError(DatabaseError):
    """Raised for programming errors, e.g. syntax errors, table already
    exists.
    """


class NotSupportedError(DatabaseError):
    """Raised when an API not supported by the database is used."""


def _translate_exception(e):
    # type: (Exception) -> Exception
    """Translate a thrift-land exception to a DB-API 2.0
    exception.
    """
    # TODO: see if there's a way to get error codes, rather than relying msgs
    if not isinstance(e, TMapDException):
github omnisci / pymapd / pymapd / exceptions.py View on Github external
"""Emitted for important warnings, e.g. data truncatiions"""


class Error(Exception):
    """Base class for all pymapd errors."""


class InterfaceError(Error):
    """Raised whenever you use pymapd interface incorrectly."""


class DatabaseError(Error):
    """Raised when the database encounters an error."""


class DataError(DatabaseError):
    """Raised for data processing errors like division by zero, etc."""


class OperationalError(DatabaseError):
    """Raised for non-programmer related database errors, e.g.
    an unexpected disconnect.
    """


class IntegrityError(DatabaseError):
    """Raised when the relational integrity of the database is affected."""


class InternalError(DatabaseError):
    """Raised for errors internal to the database, e.g. and invalid cursor."""
github omnisci / pymapd / pymapd / exceptions.py View on Github external
class DataError(DatabaseError):
    """Raised for data processing errors like division by zero, etc."""


class OperationalError(DatabaseError):
    """Raised for non-programmer related database errors, e.g.
    an unexpected disconnect.
    """


class IntegrityError(DatabaseError):
    """Raised when the relational integrity of the database is affected."""


class InternalError(DatabaseError):
    """Raised for errors internal to the database, e.g. and invalid cursor."""


class ProgrammingError(DatabaseError):
    """Raised for programming errors, e.g. syntax errors, table already
    exists.
    """


class NotSupportedError(DatabaseError):
    """Raised when an API not supported by the database is used."""


def _translate_exception(e):
    # type: (Exception) -> Exception
    """Translate a thrift-land exception to a DB-API 2.0
github omnisci / pymapd / pymapd / exceptions.py View on Github external
class DatabaseError(Error):
    """Raised when the database encounters an error."""


class DataError(DatabaseError):
    """Raised for data processing errors like division by zero, etc."""


class OperationalError(DatabaseError):
    """Raised for non-programmer related database errors, e.g.
    an unexpected disconnect.
    """


class IntegrityError(DatabaseError):
    """Raised when the relational integrity of the database is affected."""


class InternalError(DatabaseError):
    """Raised for errors internal to the database, e.g. and invalid cursor."""


class ProgrammingError(DatabaseError):
    """Raised for programming errors, e.g. syntax errors, table already
    exists.
    """


class NotSupportedError(DatabaseError):
    """Raised when an API not supported by the database is used."""