Skip to content

Raises ProgammingError, SA expects IntegrityError #1

@srprogrammer

Description

@srprogrammer

Trying to fix some of the failures that happen when the SA dialect compliance suite is run against sqlalchemy-cts.

Started with the test_dialect module.

One test which fails is tests/test_suite.py::ExceptionTest_mssql+ctds_14_0_3015_40::()::test_integrity_error

SA expects IntegryError to get raised when a duplicate PK insert is attempted. See https://github.com/zzzeek/sqlalchemy/blob/e72cf013cd11cc77de5518c1fe66c9b8b42c3548/lib/sqlalchemy/testing/requirements.py#L448-L454

Apparently most DB-API drivers do that. Even sqlalchemy-ctds currently declares so by not overriding that duplicate_key_raises_integrity_error property in requirements.py to return exclusions.closed() (which would simply cause the test case to be skipped.)

ctds raises ProgrammingError. It even has an test which involves such scenario: https://github.com/zillow/ctds/blob/54ba5842f0b7fce944883e519279c5723a643549/tests/test_cursor_execute.py#L191-L231

Actually don't know what would be the best path to follow. Hopefully this info will help you to make an informed decision.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions