Export to GitHub

sqlautocode - issue #42

ImportError: cannot import name _deferred_relation


Posted on Apr 5, 2013 by Happy Rhino

What steps will reproduce the problem? 1. Run the program. See transcript below.

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

$ sqlautocode sqlite:///tutorial.db -o models.py Traceback (most recent call last): File "/usr/local/bin/sqlautocode", line 9, in <module> load_entry_point('sqlautocode==0.7', 'console_scripts', 'sqlautocode')() File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 318, in load_entry_point

File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2221, in load_entry_point

File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 1954, in load possible to create pathological version coding schemes that will fool File "/Library/Python/2.7/site-packages/sqlautocode/main.py", line 4, in <module> from declarative import ModelFactory File "/Library/Python/2.7/site-packages/sqlautocode/declarative.py", line 17, in <module> from sqlalchemy.ext.declarative import _deferred_relation as _deferred_relationship ImportError: cannot import name _deferred_relation

What version of the product are you using? On what operating system?

SQLAlchemy (0.8.0) sqlautocode (0.7) (both freshly updated from PyPI)

On Mac OS X 10.7.5, using Python 2.7.1

Please provide any additional information below.

Comment #1

Posted on Apr 17, 2013 by Massive Dog

The attached patch should fix the error; or you can try yo use this clone: https://bitbucket.org/x746e/sqlautocode

Attachments

Comment #2

Posted on May 27, 2013 by Swift Wombat

Got the same error and can confirm that the patch fixes the issue.

Comment #3

Posted on Jul 4, 2013 by Grumpy Bear

Same issue here:

SQLAlchemy==0.8.0 sqlautocode==0.7

Comment #4

Posted on Jul 4, 2013 by Swift Camel

Comment deleted

Comment #5

Posted on Jul 4, 2013 by Swift Camel

Comment deleted

Comment #6

Posted on Jul 10, 2013 by Swift Camel

I confirm that, for SQLAlchemy==0.8.0 and sqlautocode==0.6, the patch fixes the issue.

Comment #7

Posted on Jul 13, 2013 by Quick Hippo

cannot fix in Windows.

there is no sqlautocode python source files

Comment #8

Posted on Sep 18, 2013 by Grumpy Ox

Are you planning a new release that includes this fix? SQLA 0.8 has been out for half a year now.

It's quite awkward having to manually apply a patch on a pip installed package.

Comment #9

Posted on Oct 21, 2013 by Quick Bird

I just installed this via PIP as well (Windows OS). It looks like the change (if committed) still hasn't been made a part of the latest release. I'm only an ammature, so getting this applied in my environment will require some digging. sqlalchemy->0.8.2 sqlautocode->0.7

Comment #10

Posted on Nov 18, 2013 by Massive Hippo

Agree with #9 ihiengd...@gmail.com ...

This is a little tough if you don't know how to change and easy install file. Any suggestions on how to do this ?

Comment #11

Posted on Jan 20, 2014 by Happy Camel

Thanks for patch, fixed it for me using Fedora20/sqla-0.8 and sqlautocode0.6

Comment #12

Posted on Mar 12, 2014 by Massive Elephant

Thanks for the patch!

Status: New

Labels:
Type-Defect Priority-Medium