I had do revert back to alembic 0.6.7 for the down-migration to work again 
(upgraded today from 0.6.6). Please find attached the bare scripts.


On Monday, August 3, 2015 at 11:27:40 PM UTC+2, Michael Bayer wrote:
>
> can you confirm no issue with Alembic 0.7.6?    Can you please send along 
> all of your migration scripts; feel free to erase everything but the 
> version headers and empty upgrade() / downgrade() functions, I just need to 
> see the structure you're working with.  thanks.
>
>
>
> On 8/3/15 4:59 PM, Dirk Makowski wrote:
>
> 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+...@googlegroups.com <javascript:>.
> To post to this group, send email to sqlal...@googlegroups.com 
> <javascript:>.
> Visit this group at http://groups.google.com/group/sqlalchemy.
> For more options, visit https://groups.google.com/d/optout.
>
>
>

-- 
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.

Attachment: alembic.tar.gz
Description: Binary data

Reply via email to