ibmdb / python-ibmdb-django

IBM DB2 Driver for the Django application Framework
Apache License 2.0
29 stars 42 forks source link

Can someone help me with this error "AttributeError: module 'ibm_db_dbi' has no attribute 'BOOLEAN' #58

Closed reddibhatini closed 3 years ago

reddibhatini commented 3 years ago

When I run "python manage.py test" I get this error AttributeError: module 'ibm_db_dbi' has no attribute 'BOOLEAN' Any one seen this issue before? Appreciate throwing some light on this.

I had django, python, ibm-db-django versions correct.

Thank you

praveen-db2 commented 3 years ago

@reddibhatini pls add below this line after DATETIME and ROWID in file ibm_db_dbi.py file which you get when you install ibm_db python driver. In next release of python driver you will have this fix.

DATETIME = DBAPITypeObject(("TIMESTAMP",))

ROWID = DBAPITypeObject(())

++BOOLEAN = DBAPITypeObject(("BOOLEAN",))"

praveen-db2 commented 3 years ago

@reddibhatini I am using python = 3.7.4, Django = 3.1, ibm_db_django = 1.4.0.0

reddibhatini commented 3 years ago

@praveen-db2 That didn't resolve my issue. I tried environment versions you mentioned above. Can you let me know any other changes needs to be done.

praveen-db2 commented 3 years ago

@reddibhatini can you pls do below change as well in ibm_db_dbi.py along with above change i said.

def __get_description(self):
    """ If this method has already been called, after executing a select statement,
        return the stored information in the self.__description.
    """
    if self.__description is not None:
        return self.__description

    if self.stmt_handler is None:
        return None
    self.__description = []
    .....
    .....
    .....
            elif ROWID == type:
                column_desc.append(ROWID)
  ++        elif BOOLEAN == type:
  ++            column_desc.append(BOOLEAN)
    .....
    .....
    .....
reddibhatini commented 3 years ago

@praveen-db2 Still getting same error

praveen-db2 commented 3 years ago

@reddibhatini Hi just came to know that ibm_db (DB2 python driver) has not yet released with support for BOOLEAN. I used test version of it, hence its working for me. I will ask respective engineer to support the same and release at earliest. At that time you no need to to above changes i said. It will be done in upcoming ibm_db version.

imavo commented 3 years ago

It would be helpful if this can be resolved as it prevents using currently supported versions of django framework with Db2-LUW versions that support BOOLEAN , i.e this is a blocker.

praveen-db2 commented 3 years ago

@imavo python-ibmdb team is already working on it. You will get release shortly. Apologies for delay.

imavo commented 3 years ago

The ibm_db release 3.0.4 and its matching clidriver, appear to fix this problem.

So the following combination of versions works correctly with django framework v3.1.8

python 3.8.5
pip 21.0.1
regex 2021.4.4
ibm_db  3.0.4 (and its default clidriver)
ibm_db_django 1.4.0.0
django 3.1.8