exasol / sqlalchemy-exasol

SQLAlchemy dialect for EXASOL
https://exasol.github.io/sqlalchemy-exasol/
Other
34 stars 28 forks source link

turbodbc based dialect does not raise an integrity when inserting pk twice #119

Closed Nicoretti closed 1 year ago

Nicoretti commented 2 years ago

Steps To Reproduce:

Add the tests below to test/test_suit.py and execute the integration tests or just the test itself. (using the turbodbc connector)

from sqlalchemy.testing.suite import ExceptionTest as _ExceptionTest
from sqlalchemy import text

class ExceptionTest(_ExceptionTest):

    def test_integrity_error(self):

        with config.db.connect() as conn:

            trans = conn.begin()
            conn.execute(
                self.tables.manual_pk.insert(), {"id": 1, "data": "d1"}
            )

            assert_raises(
                exc.IntegrityError,
                conn.execute,
                self.tables.manual_pk.insert(),
                {"id": 1, "data": "d1"},
            )

            trans.rollback()

    def test_integrity_error_raw_sql(self):
        with config.db.connect() as conn:
            statement = text("INSERT INTO MANUAL_PK VALUES (1, 'd1')")
            conn.execute(statement)

            assert_raises(
                exc.IntegrityError,
                conn.execute,
                statement
            )

Expected Behavior

:heavy_check_mark: Test passes because an sqlalchemy.exec.IntegrityError is risen.

Actual Behavior

:boom: Test fails because no exception is risen.

Related Issues

Nicoretti commented 1 year ago

Won't fix, turbodbc support will be dropped.