As the tool sqlautocode doesn’t work with sqlaclhemy >= 0.8 I’ve patched it to get to work.

(of course I’ve send the patch to the maintainers but I fear the project isn’t very alive)

Here’s the patch:

diff -u sqlautocode/ my_sqlautocode/
 diff -u sqlautocode/config.py my_sqlautocode/config.py
 --- sqlautocode/config.py 2014-06-06 10:29:55.000000000 +0200
 +++ my_sqlautocode/config.py 2014-06-06 10:22:56.000000000 +0200
 @@ -140,7 +140,7 @@
 engine = sqlalchemy.create_engine(url)
 test = engine.connect()
 test.close()
 - except sqlalchemy.exceptions.SQLAlchemyError, ex:
 + except sqlalchemy.exc.SQLAlchemyError, ex:
 parser.error('Could not connect to "%s": %s' % (url, ex))
diff -u sqlautocode/declarative.py my_sqlautocode/declarative.py
 --- sqlautocode/declarative.py 2014-06-06 10:29:55.000000000 +0200
 +++ my_sqlautocode/declarative.py 2014-06-06 10:08:09.000000000 +0200
 @@ -14,8 +14,12 @@
 from sqlalchemy.ext.declarative import _deferred_relationship
 except ImportError:
 #SA 0.5 support
 - from sqlalchemy.ext.declarative import _deferred_relation as _deferred_relationship
 -
 + try:
 + from sqlalchemy.ext.declarative import _deferred_relation as _deferred_relationship
 + except ImportError:
 + #SA 0.8 support
 + from sqlalchemy.ext.declarative.clsregistry import _deferred_relationship
 +