Mitigate AssertionError for unique constraints #56
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Additional improvements that follow PR #52, which provided partial relief to address failing tests involving reflection of tables containing unique constraints. More work was needed in overloaded method
IngresDialect::get_unique_constraints
to return the correct constraint list in a proper format.It is also worth noting that a few changes to requirements.py to be delivered in this PR should have been included in PR #52. Without those changes, the code delivered in PR #52 will still have problems.
Refactoring of
get_unique_constraints
The logic of
get_unique_constraints
was refactored so that this method is now returns a list of dictionaries, with each dictionary containing the name and column(s) of a unique constraint.It is worth noting that if the constraint name was auto-generated by the SQL engine (versus explicitly named in the application's
CREATE TABLE
statement), the constraint name is returned asNone
(following the example of the SQLite dialect).Example of constraint data returned from
IngresDialect::get_unique_constraints
Testing
pytest --db ingres_odbc -vv --maxfail=100 .\test\dialect\test_suite.py -k "test_get_multi_unique_constraints" --tb=no
Impact of Fix
Results when running
test_get_multi_unique_constraints
of the SQLAlchemy dialect compliance suite.Environment
Internal ticket II-14398