New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

autogenerate crashes when key attribute is used on Column #99

Closed
sqlalchemy-bot opened this Issue Jan 11, 2013 · 2 comments

Comments

Projects
None yet
1 participant
@sqlalchemy-bot

sqlalchemy-bot commented Jan 11, 2013

Migrated issue, originally created by James Iseppi (@iseppi)

A model with a Column like:
filename = sa.Column(sa.types.Text, key='_filename', nullable=False)
Will cause alembic revision --autogenerate to crash with the following traceback:

Traceback (most recent call last):
File "/home/james/zookeepr/env/bin/alembic", line 9, in
load_entry_point('alembic==0.4.1', 'console_scripts', 'alembic')()
File "/home/james/zookeepr/env/local/lib/python2.7/site-packages/alembic-0.4.1-py2.7.egg/alembic/config.py", line 255, in main
CommandLine(prog=prog).main(argv=argv)
File "/home/james/zookeepr/env/local/lib/python2.7/site-packages/alembic-0.4.1-py2.7.egg/alembic/config.py", line 250, in main
self.run_cmd(cfg, options)
File "/home/james/zookeepr/env/local/lib/python2.7/site-packages/alembic-0.4.1-py2.7.egg/alembic/config.py", line 241, in run_cmd
**dict((k, getattr(options, k)) for k in kwarg)
File "/home/james/zookeepr/env/local/lib/python2.7/site-packages/alembic-0.4.1-py2.7.egg/alembic/command.py", line 97, in revision
script.run_env()
File "/home/james/zookeepr/env/local/lib/python2.7/site-packages/alembic-0.4.1-py2.7.egg/alembic/script.py", line 191, in run_env
util.load_python_file(self.dir, 'env.py')
File "/home/james/zookeepr/env/local/lib/python2.7/site-packages/alembic-0.4.1-py2.7.egg/alembic/util.py", line 185, in load_python_file
module = imp.load_source(module_id, path, open(path, 'rb'))
File "alembic/env.py", line 71, in
run_migrations_online()
File "alembic/env.py", line 64, in run_migrations_online
context.run_migrations()
File "", line 7, in run_migrations
File "/home/james/zookeepr/env/local/lib/python2.7/site-packages/alembic-0.4.1-py2.7.egg/alembic/environment.py", line 494, in run_migrations
self.get_context().run_migrations(**kw)
File "/home/james/zookeepr/env/local/lib/python2.7/site-packages/alembic-0.4.1-py2.7.egg/alembic/migration.py", line 200, in run_migrations
self):
File "/home/james/zookeepr/env/local/lib/python2.7/site-packages/alembic-0.4.1-py2.7.egg/alembic/command.py", line 83, in retrieve_migrations
autogen._produce_migration_diffs(context, template_args, imports)
File "/home/james/zookeepr/env/local/lib/python2.7/site-packages/alembic-0.4.1-py2.7.egg/alembic/autogenerate.py", line 127, in _produce_migration_diffs
include_schemas)
File "/home/james/zookeepr/env/local/lib/python2.7/site-packages/alembic-0.4.1-py2.7.egg/alembic/autogenerate.py", line 188, in _produce_net_changes
inspector, metadata, diffs, autogen_context)
File "/home/james/zookeepr/env/local/lib/python2.7/site-packages/alembic-0.4.1-py2.7.egg/alembic/autogenerate.py", line 224, in _compare_tables
diffs, autogen_context)
File "/home/james/zookeepr/env/local/lib/python2.7/site-packages/alembic-0.4.1-py2.7.egg/alembic/autogenerate.py", line 259, in _compare_columns
metadata_col = metadata_table.c[colname]
File "/home/james/zookeepr/env/local/lib/python2.7/site-packages/sqlalchemy/util/_collections.py", line 88, in getitem
return self._data[key]
KeyError: u'filename'

@sqlalchemy-bot

This comment has been minimized.

sqlalchemy-bot commented Jan 11, 2013

Michael Bayer (@zzzeek) wrote:

a41b090

@sqlalchemy-bot

This comment has been minimized.

sqlalchemy-bot commented Jan 11, 2013

Changes by Michael Bayer (@zzzeek):

  • changed status to closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment