sqlalchemy.sqlalchemy_exc.StatementError

Here are the examples of the python api sqlalchemy.sqlalchemy_exc.StatementError taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Examples 7

Example 1

Project: designate Source File: utils.py
def check_marker(table, marker, session):

    marker_query = select([table]).where(table.c.id == marker)

    try:
        marker_resultproxy = session.execute(marker_query)
        marker = marker_resultproxy.fetchone()
        if marker is None:
            raise exceptions.MarkerNotFound(
                'Marker %s could not be found' % marker)
    except oslo_db_exception.DBError as e:
        # Malformed UUIDs return StatementError wrapped in a
        # DBError
        if isinstance(e.inner_exception,
                      sqlalchemy_exc.StatementError):
            raise exceptions.InvalidMarker()
        else:
            raise

    return marker