Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for errors running dialect compliance suite #46

Merged
merged 1 commit into from
May 1, 2024
Merged

Conversation

hab6
Copy link
Contributor

@hab6 hab6 commented Apr 30, 2024

Summary

Code changes to fix several errors that occur when running the SQLAlchemy dialect compliance suite with the Ingres dialect and an Ingres 11.2 database. The fixes allow the relevant tests to run beyond specific points of failure. Other errors are subsequently encountered and will be dealt with in different issues.

Environment and versions

Partial list of Python packages. Client and server are the same machine.

Microsoft Windows [Version 10.0.19045.4170]
Database: Ingres 11.2.0 (a64.win/100) 15807
Python 3.10.7
mock              5.1.0
pip               24.0
pluggy            1.5.0
pyodbc            5.1.0
pypyodbc          1.3.6
pytest            8.2.0
setuptools        63.2.0
SQLAlchemy        2.0.29.dev0
sqlalchemy-ingres 0.0.7.dev1
tox               4.15.0

 

Fix 1

Internal tracking II-14170

Various tests such as AutocommitIsolationTest fail with these messages:

TypeError: 'NoneType' object is not subscriptable

The error is alleviated by adding method get_isolation_level_values to class IngresDialect that returns the list of isolation level keywords supported by Ingres.

With the fix, a new error DBAPI has no isolation level support occurs that will be dealt with in a separate issue (TBD).

Fix 2

Internal tracking II-14171

The ComponentReflectionTest class contains 732 tests, all of which fail with this error:

NotImplementedError: no temp table keyword args routine for cfg:
ingres+pyodbc:///sqatestdb

The error is alleviated by adding a decorated method in new file provision.py.

Fix 3

After fixing the above error that reported no temp table keyword args routine for cfg, many of the tests in class ComponentReflectionTest subsequently failed with the following error (example with the corresponding bad SQL):

sqlalchemy.exc.ProgrammingError: (pyodbc.ProgrammingError) ('42000', "[42000]
[Actian][Actian II ODBC Driver][INGRES]  CREATE TABLE: A column in a UNIQUE
constraint has been defined as WITH NULL (on table 'user_tmp_main'). All columns
in a UNIQUE constraint MUST be created as NOT NULL. (328832) (SQLExecDirectW)")

[SQL:
CREATE TABLE user_tmp_main (
    id INTEGER GENERATED BY DEFAULT AS IDENTITY NOT NULL,
    name VARCHAR(50),
    foo INTEGER,
    PRIMARY KEY (id),
    CONSTRAINT user_tmp_uq_main UNIQUE (name) )

The error is alleviated in the Ingres dialect during column processing by checking whether any of the table columns are part of a unique constraint of the same table and if so, adding a NOT NULL clause for the column.

Future Fix

Upon applying the above fixes, many of the affected test cases now fail with the following (already known) error when using the Ingres dialect that is being tracked by internal ticket II-14148.

[42503] [Actian][Actian II ODBC Driver][INGRES]CREATE TABLE:
You may not create an object owned by 'test_schema'. (328737) (SQLExecDirectW)")
[SQL:
CREATE TABLE test_schema.users (
    user_id INTEGER GENERATED BY DEFAULT AS IDENTITY NOT NULL,
    test1 CHAR(5) NOT NULL,
    test2 FLOAT NOT NULL,
    parent_user_id INTEGER NOT NULL,
    PRIMARY KEY (user_id),
    CONSTRAINT zz_test2_gt_zero CHECK (test2 > 0),
    CHECK (test2 <= 1000),
    CONSTRAINT user_id_fk FOREIGN KEY(parent_user_id)
        REFERENCES test_schema.users (user_id) ) ]

Copy link

@mianculovici mianculovici left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@hab6 hab6 merged commit 8907df5 into master May 1, 2024
@hab6 hab6 deleted the hab6-prelim-fixes branch May 1, 2024 13:56
hab6 added a commit that referenced this pull request May 1, 2024
Bump dev version to differentiate before/after merge of #46 #47.
@hab6 hab6 mentioned this pull request May 1, 2024
hab6 added a commit that referenced this pull request May 1, 2024
Bump dev version to differentiate before/after merge of #46 #47.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants