Hi All,

I'm a beginner in Python and Flask ecosystems, trying to create a small 
proof-of-concept Web application for a research project. I'm using Debian 
Linux 7.9, PostgreSQL 9.5, SQLAlchemy (latest) and Flask-AppBuilder 
(latest). Since creating models manually is tedious and error-prone, I 
searched the mighty Internet and discovered the "flask-sqlacodegen" project 
(note that this a fork of "sqlacodegen" with improved features for Flask 
users). I installed "flask-sqlqcodegen" from GitHub (cloned repo and then 
ran "python setup.py install"). However, when trying to use it to generate 
models, it produces an error, as follows:

> sqlacodegen postgresql+psycopg2://USER:PASS@HOST/DBNAME --flask

Traceback (most recent call last):
  File "/usr/local/bin/sqlacodegen", line 9, in <module>
    load_entry_point('sqlacodegen==1.1.5.pre2', 'console_scripts', 
'sqlacodegen')()
  File 
"/usr/local/lib/python2.7/dist-packages/sqlacodegen-1.1.5.pre2-py2.7.egg/sqlacodegen/main.py",
 
line 57, in main
    args.flask, fkcols)
  File 
"/usr/local/lib/python2.7/dist-packages/sqlacodegen-1.1.5.pre2-py2.7.egg/sqlacodegen/codegen.py",
 
line 597, in __init__
    model = ModelClass(table, links[table.name], inflect_engine, not 
nojoined)
  File 
"/usr/local/lib/python2.7/dist-packages/sqlacodegen-1.1.5.pre2-py2.7.egg/sqlacodegen/codegen.py",
 
line 319, in __init__
    relationship_ = ManyToOneRelationship(self.name, target_cls, 
constraint, inflect_engine)
  File 
"/usr/local/lib/python2.7/dist-packages/sqlacodegen-1.1.5.pre2-py2.7.egg/sqlacodegen/codegen.py",
 
line 455, in __init__
    colname = constraint.columns[0]
  File 
"/usr/local/lib/python2.7/dist-packages/sqlalchemy/util/_collections.py", 
line 194, in __getitem__
    return self._data[key]
KeyError: 0

What is going on? Any help will be much appreciated. I hope that it's OK to 
repost this question to StackOverflow to increase exposure.

Sincerely,
Alex

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to