juxj / sqlautocode

Automatically exported from code.google.com/p/sqlautocode
Other
0 stars 0 forks source link

Get set Error #39

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. sqlautocode -d -o flaskmodel.py mysql://root:admin@localhost/airplane
2.
3.

What is the expected output? What do you see instead?

TypeError: 'set' object does not support indexing

What version of the product are you using? On what operating system?
python2.7 windows xp sqlalchemy 0.7

Please provide any additional information below.

Original issue reported on code.google.com by x1dest...@gmail.com on 9 Apr 2012 at 3:51

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I think this issue has been solved in the trunk. But could be helpful for 
anyone else facing the issue currently. I also faced the same issue and was 
able to find the cause. 

Inside declarative.py module within sqlautocode, it is using 'foreign_keys' 
attribute of Column class as if it is a list while in reality it is a set 
object due to which it is throwing the indexing error. In multiple places in 
the module this attribute has been used with indexers. If you convert it to a 
list in those places it will work fine.

Attaching the modified file. Have not created a patch as I had initially done a 
simple install.

Original comment by hthalanc...@clickable.com on 23 May 2012 at 2:31

Attachments:

GoogleCodeExporter commented 9 years ago
Here's a diff made from the code posted by commenter above (#2 
hthalanc...@clickable.com)

And it works for me! Thanks!

Original comment by michaelf...@gmail.com on 28 Apr 2014 at 7:23

Attachments: