[Sqlalchemy-tickets] Issue #3998: Problems using automap_base with DB2-s SAMPLE DB (zzzeek/sqlalche
Brought to you by:
zzzeek
From: Krzysztof M. <iss...@bi...> - 2017-05-23 13:52:18
|
New issue 3998: Problems using automap_base with DB2-s SAMPLE DB https://bitbucket.org/zzzeek/sqlalchemy/issues/3998/problems-using-automap_base-with-db2-s Krzysztof Malinowski: Using the official docker form IBM: https://hub.docker.com/r/ibmcom/db2express-c/ ``` #!bash 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: ``` #!python 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: ``` #!python 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 |