Error when running migration from scratch (empty db)

31 views
Skip to first unread message

vmalloc

unread,
Dec 30, 2014, 2:54:58 AM12/30/14
to sqlalchem...@googlegroups.com
I am using a basic scenario in which I run upgrade on an empty db using Flask-Migrate and alembic. This used to work under Alembic 0.6.7, but now I'm getting this:

  File "/usr/local/lib/python2.7/site-packages/flask_migrate/__init__.py", line 98, in upgrade
    command.upgrade(config, revision, sql = sql, tag = tag)
  File "/usr/local/lib/python2.7/site-packages/alembic/command.py", line 165, in upgrade
    script.run_env()
  File "/usr/local/lib/python2.7/site-packages/alembic/script.py", line 382, in run_env
    util.load_python_file(self.dir, 'env.py')
  File "/usr/local/lib/python2.7/site-packages/alembic/util.py", line 241, in load_python_file
    module = load_module_py(module_id, path)
  File "/usr/local/lib/python2.7/site-packages/alembic/compat.py", line 79, in load_module_py
    mod = imp.load_source(module_id, path, fp)
  File "migrations/env.py", line 72, in <module>
    run_migrations_online()
  File "migrations/env.py", line 65, in run_migrations_online
    context.run_migrations()
  File "<string>", line 7, in run_migrations
  File "/usr/local/lib/python2.7/site-packages/alembic/environment.py", line 742, in run_migrations
    self.get_context().run_migrations(**kw)
  File "/usr/local/lib/python2.7/site-packages/alembic/migration.py", line 296, in run_migrations
    for step in self._migrations_fn(heads, self):
  File "/usr/local/lib/python2.7/site-packages/alembic/command.py", line 154, in upgrade
    return script._upgrade_revs(revision, rev)
  File "/usr/local/lib/python2.7/site-packages/alembic/script.py", line 303, in _upgrade_revs
    revs = list(revs)
  File "/usr/local/lib/python2.7/site-packages/alembic/revision.py", line 581, in _iterate_revisions
    upper_ancestors = set(self._get_ancestor_nodes(uppers, check=True))
  File "/usr/local/lib/python2.7/site-packages/alembic/revision.py", line 551, in _iterate_related_revisions
    map_[rev_id] for rev_id in fn(rev))
  File "/usr/local/lib/python2.7/site-packages/alembic/revision.py", line 531, in <lambda>
    fn = lambda rev: rev._all_down_revisions
AttributeError: 'NoneType' object has no attribute '_all_down_revisions'

I'm not sure this is an Alembic issue, but not sure where to start investigating either... Any clues anyone?

Thanks

Michael Bayer

unread,
Dec 30, 2014, 10:00:37 AM12/30/14
to sqlalchem...@googlegroups.com
looks a bit like an alembic issue.

do you have a lot of migration files, and if the number is few, what does an “alembic history” look like here?   something about your revision tree is weird.  Or in conjunction with what’s being passed, can you tell what “revision” is at the start of the stack ?


vmalloc <vma...@gmail.com> wrote:

--
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 sqlalchemy-alem...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Michael Bayer

unread,
Dec 30, 2014, 11:15:45 AM12/30/14
to sqlalchem...@googlegroups.com
oh.    You have *no* versions, that does it.   Right!   OK that’s a bug on my end.   will fix.



Michael Bayer <mik...@zzzcomputing.com> wrote:

Michael Bayer

unread,
Dec 30, 2014, 12:19:09 PM12/30/14
to sqlalchem...@googlegroups.com

Rotem Yaari

unread,
Dec 30, 2014, 12:54:22 PM12/30/14
to sqlalchem...@googlegroups.com, sqlalchem...@googlegroups.com
Thanks! Will try again. I am not 100% sure but I think a similar issue happened even when versions were present. Will report back with findings. 


Rotem


--
You received this message because you are subscribed to a topic in the Google Groups "sqlalchemy-alembic" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sqlalchemy-alembic/kAtXurF-SYU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sqlalchemy-alem...@googlegroups.com.

vma...@gmail.com

unread,
Dec 30, 2014, 3:04:56 PM12/30/14
to sqlalchem...@googlegroups.com, sqlalchem...@googlegroups.com
Ok. This works for me, and I probably hallucinated the bug with the populated versions. Thanks for the quick response!


Rotem
Reply all
Reply to author
Forward
0 new messages