- edited description
Problems using automap_base with DB2-s SAMPLE DB
Using the official docker form IBM for DB2 10.5.5:
https://hub.docker.com/r/ibmcom/db2express-c/
docker run -it -p 50000:50000 -e DB2INST1_PASSWORD=mypass -e LICENSE=accept ibmcom/db2express-c:latest bash
# create db
su - db2inst1
db2start
db2sampl
python requirements:
#!
sqlalchemy==1.0.17
ibm-db==2.0.5.1
ibm_db_sa==0.3.2
(btw. tried this with the newest versions also - same result)
OS:
#!
Ubuntu 14.04 64bit
Doing:
from sqlalchemy.ext.automap import automap_base
from sqlalchemy import create_engine
Base = automap_base()
engine = create_engine("db2://db2inst1:mypass@172.18.0.1:50000/SAMPLE")
Base.prepare(engine, reflect=True)
raises:
Traceback (most recent call last):
File "db2_automap.py", line 8, in <module>
Base.prepare(engine, reflect=True)
File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/ext/automap.py", line 777, in prepare
generate_relationship)
File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/ext/automap.py", line 899, in _relationships_for_fks
nullable = False not in set([fk.parent.nullable for fk in fks])
AttributeError: 'NoneType' object has no attribute 'nullable'
seems that some fk-s have incorrect parent and column attributes
Comments (8)
-
reporter -
repo owner - changed status to invalid
the DB2 dialect is not produced or maintained by the SQLAlchemy project. Please see https://github.com/ibmdb/python-ibmdb
-
repo owner - changed status to duplicate
Duplicate of
#3949. -
reporter OK. Thanks - I'll try my luck there :)
-
repo owner sorry, they have some issue in their reflection code and I need their help to sanity check on their end.
-
reporter I've copied this issue over to https://github.com/ibmdb/python-ibmdbsa/issues/20
-
repo owner Raise if ForeignKeyConstraint created with different numbers of local and remote columns.
An :class:
.ArgumentError
is now raised if a :class:.ForeignKeyConstraint
object is created with a mismatched number of "local" and "remote" columns, which otherwise causes the internal state of the constraint to be incorrect. Note that this also impacts the condition where a dialect's reflection process produces a mismatched set of columns for a foreign key constraint.Downstream DB2 dialect has been reported as potentially causing this scenario.
Change-Id: Id51c34a6c43749bb582639f9c1dc28723482f0e5 Fixes:
#3949References:#3998→ <<cset a78718b9340e>>
-
repo owner Raise if ForeignKeyConstraint created with different numbers of local and remote columns.
An :class:
.ArgumentError
is now raised if a :class:.ForeignKeyConstraint
object is created with a mismatched number of "local" and "remote" columns, which otherwise causes the internal state of the constraint to be incorrect. Note that this also impacts the condition where a dialect's reflection process produces a mismatched set of columns for a foreign key constraint.Downstream DB2 dialect has been reported as potentially causing this scenario.
Change-Id: Id51c34a6c43749bb582639f9c1dc28723482f0e5 Fixes:
#3949References:#3998(cherry picked from commit a78718b9340e9840a470300932af178ce57c0f7d)→ <<cset 0769b41cf291>>
- Log in to comment