Hi all,

after upgrading alembic to 0.7.7 and SQLAlchemy to 1.0.8, when I try to 
downgrade one step from head, I get the below KeyError. The allegedly 
missing key is the revision ID of head. It is correctly stored in the 
alembic table, and the file and its predecessor are also present.

Other commands however do find that key:

{{{
$ alembic -c etc/Morrigan/development/alembic.ini heads --verbose
Rev: 32f69b44319 (head)
Parent: 1644537aa7
Path: 
/home/dm/myprojects/Foo/alembic/versions/32f69b44319_20150714_feat_mdv_mgmt.py

    20150714_feat_mdv_mgmt
    
    Revision ID: 32f69b44319
    Revises: 1644537aa7
    Create Date: 2015-07-20 14:52:40.227436
}}}

and

{{{
$ alembic -c etc/Morrigan/development/alembic.ini show  32f69b44319 
Rev: 32f69b44319 (head)
Parent: 1644537aa7
Path: 
/home/dm/myprojects/Foo/alembic/versions/32f69b44319_20150714_feat_mdv_mgmt.py

    20150714_feat_mdv_mgmt
    
    Revision ID: 32f69b44319
    Revises: 1644537aa7
    Create Date: 2015-07-20 14:52:40.227436
}}}

But downgrading gives:

{{{
$ alembic -c etc/Morrigan/development/alembic.ini  downgrade  -1
INFO  [alembic.migration] Context impl PostgresqlImpl.
INFO  [alembic.migration] Will assume transactional DDL.
Traceback (most recent call last):
  File "/home/dm/myprojects/atrial-py34-venv/bin/alembic", line 9, in 
<module>
    load_entry_point('alembic==0.7.7', 'console_scripts', 'alembic')()
  File 
"/home/dm/myprojects/atrial-py34-venv/lib/python3.4/site-packages/alembic/config.py",
 
line 439, in main
    CommandLine(prog=prog).main(argv=argv)
  File 
"/home/dm/myprojects/atrial-py34-venv/lib/python3.4/site-packages/alembic/config.py",
 
line 433, in main
    self.run_cmd(cfg, options)
  File 
"/home/dm/myprojects/atrial-py34-venv/lib/python3.4/site-packages/alembic/config.py",
 
line 416, in run_cmd
    **dict((k, getattr(options, k)) for k in kwarg)
  File 
"/home/dm/myprojects/atrial-py34-venv/lib/python3.4/site-packages/alembic/command.py",
 
line 193, in downgrade
    script.run_env()
  File 
"/home/dm/myprojects/atrial-py34-venv/lib/python3.4/site-packages/alembic/script.py",
 
line 390, in run_env
    util.load_python_file(self.dir, 'env.py')
  File 
"/home/dm/myprojects/atrial-py34-venv/lib/python3.4/site-packages/alembic/util.py",
 
line 244, in load_python_file
    module = load_module_py(module_id, path)
  File 
"/home/dm/myprojects/atrial-py34-venv/lib/python3.4/site-packages/alembic/compat.py",
 
line 68, in load_module_py
    module_id, path).load_module(module_id)
  File "<frozen importlib._bootstrap>", line 539, in _check_name_wrapper
  File "<frozen importlib._bootstrap>", line 1614, in load_module
  File "<frozen importlib._bootstrap>", line 596, in _load_module_shim
  File "<frozen importlib._bootstrap>", line 1220, in load
  File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 1129, in _exec
  File "<frozen importlib._bootstrap>", line 1471, in exec_module
  File "<frozen importlib._bootstrap>", line 321, in 
_call_with_frames_removed
  File "alembic/env.py", line 97, in <module>
    run_migrations_online()
  File "alembic/env.py", line 92, in run_migrations_online
    context.run_migrations()
  File "<string>", line 7, in run_migrations
  File 
"/home/dm/myprojects/atrial-py34-venv/lib/python3.4/site-packages/alembic/environment.py",
 
line 738, in run_migrations
    self.get_context().run_migrations(**kw)
  File 
"/home/dm/myprojects/atrial-py34-venv/lib/python3.4/site-packages/alembic/migration.py",
 
line 302, in run_migrations
    for step in self._migrations_fn(heads, self):
  File 
"/home/dm/myprojects/atrial-py34-venv/lib/python3.4/site-packages/alembic/command.py",
 
line 182, in downgrade
    return script._downgrade_revs(revision, rev)
  File 
"/home/dm/myprojects/atrial-py34-venv/lib/python3.4/site-packages/alembic/script.py",
 
line 315, in _downgrade_revs
    current_rev, destination)
  File 
"/home/dm/myprojects/atrial-py34-venv/lib/python3.4/site-packages/alembic/revision.py",
 
line 512, in iterate_revisions
    inclusive, assert_relative_length
  File 
"/home/dm/myprojects/atrial-py34-venv/lib/python3.4/site-packages/alembic/revision.py",
 
line 450, in _relative_iterate
    inclusive=inclusive, implicit_base=implicit_base))
  File 
"/home/dm/myprojects/atrial-py34-venv/lib/python3.4/site-packages/alembic/revision.py",
 
line 672, in _iterate_revisions
    total_space.remove(rev.revision)
KeyError: '32f69b44319'
}}}

Thanks for your help,
Dirk

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to