Is it likely that this construct:

@event.listens_for(Column, "before_parent_attach")
def attach(target, cls):
    # cls is the table obj, not the declarative class
    target.name = "%s%s" % (cls.name[0:4], target.name)


is interfering with Alembic??

I'm getting this stack trace and it changes if I disable the event listener 
above.

I don't actually have any columns named  "cat_cat_sit_id" so it looks like 
that prefix is being double attached???

Thanks for any suggestions to fix this.
Dewey

INFO  [alembic.autogenerate.compare] Detected added foreign key 
(ctr_gem_id)(ctr_gem_id) on table cat_ctr_att

INFO  [alembic.autogenerate.compare] Detected added foreign key 
(dtw_id)(dtw_id) on table cat_ctr_att

INFO  [alembic.autogenerate.compare] Detected added foreign key 
(sit_id)(sit_id) on table cat_ctr_att

Traceback (most recent call last):

  File "/Users/dgaedcke/Virtualenvs/paysys/bin/alembic", line 9, in <module>

    load_entry_point('alembic==0.7.2', 'console_scripts', 'alembic')()

  File 
"/Users/dgaedcke/Virtualenvs/paysys/lib/python2.7/site-packages/alembic/config.py",
 
line 399, in main

    CommandLine(prog=prog).main(argv=argv)

  File 
"/Users/dgaedcke/Virtualenvs/paysys/lib/python2.7/site-packages/alembic/config.py",
 
line 393, in main

    self.run_cmd(cfg, options)

  File 
"/Users/dgaedcke/Virtualenvs/paysys/lib/python2.7/site-packages/alembic/config.py",
 
line 376, in run_cmd

    **dict((k, getattr(options, k)) for k in kwarg)

  File 
"/Users/dgaedcke/Virtualenvs/paysys/lib/python2.7/site-packages/alembic/command.py",
 
line 113, in revision

    script.run_env()

  File 
"/Users/dgaedcke/Virtualenvs/paysys/lib/python2.7/site-packages/alembic/script.py",
 
line 382, in run_env

    util.load_python_file(self.dir, 'env.py')

  File 
"/Users/dgaedcke/Virtualenvs/paysys/lib/python2.7/site-packages/alembic/util.py",
 
line 241, in load_python_file

    module = load_module_py(module_id, path)

  File 
"/Users/dgaedcke/Virtualenvs/paysys/lib/python2.7/site-packages/alembic/compat.py",
 
line 79, in load_module_py

    mod = imp.load_source(module_id, path, fp)

  File "alembic/env.py", line 74, in <module>

    run_migrations_online()

  File "alembic/env.py", line 67, in run_migrations_online

    context.run_migrations()

  File "<string>", line 7, in run_migrations

  File 
"/Users/dgaedcke/Virtualenvs/paysys/lib/python2.7/site-packages/alembic/environment.py",
 
line 742, in run_migrations

    self.get_context().run_migrations(**kw)

  File 
"/Users/dgaedcke/Virtualenvs/paysys/lib/python2.7/site-packages/alembic/migration.py",
 
line 296, in run_migrations

    for step in self._migrations_fn(heads, self):

  File 
"/Users/dgaedcke/Virtualenvs/paysys/lib/python2.7/site-packages/alembic/command.py",
 
line 95, in retrieve_migrations

    autogen._produce_migration_diffs(context, template_args, imports)

  File 
"/Users/dgaedcke/Virtualenvs/paysys/lib/python2.7/site-packages/alembic/autogenerate/api.py",
 
line 145, in _produce_migration_diffs

    autogen_context, object_filters, include_schemas)

  File 
"/Users/dgaedcke/Virtualenvs/paysys/lib/python2.7/site-packages/alembic/autogenerate/api.py",
 
line 247, in _produce_net_changes

    inspector, metadata, diffs, autogen_context)

  File 
"/Users/dgaedcke/Virtualenvs/paysys/lib/python2.7/site-packages/alembic/autogenerate/compare.py",
 
line 118, in _compare_tables

    inspector)

  File 
"/usr/local/Cellar/python/2.7.8_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py",
 
line 24, in __exit__

    self.gen.next()

  File 
"/Users/dgaedcke/Virtualenvs/paysys/lib/python2.7/site-packages/alembic/autogenerate/compare.py",
 
line 208, in _compare_columns

    if _run_filters(conn_table.c[cname], cname,

  File 
"/Users/dgaedcke/Virtualenvs/paysys/lib/python2.7/site-packages/sqlalchemy/util/_collections.py",
 
line 157, in __getitem__

    return self._data[key]

KeyError: u'cat_cat_sit_id'

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy-alembic" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to