Issues

Issue #83 resolved

"alembic downgrade -1" fails with spurious # of arguments error

David Ripton avatarDavid Ripton created an issue

Running alembic 0.4.0 (from pip), on a Fedora 17 box, with SQLAlchemy 0.7.9 (from pip), and mysql as the DB.

[dripton@dripton sqlalchemy]$ alembic downgrade -1 INFO [alembic.migration] Context impl MySQLImpl. INFO [alembic.migration] Will assume non-transactional DDL. INFO [alembic.migration] Running downgrade 5896b53ac5b4 -> 3d948a0be96 Traceback (most recent call last): File "/usr/bin/alembic", line 9, in <module> load_entry_point('alembic==0.4.0', 'console_scripts', 'alembic')() File "/usr/lib/python2.7/site-packages/alembic/config.py", line 255, in main CommandLine(prog=prog).main(argv=argv) File "/usr/lib/python2.7/site-packages/alembic/config.py", line 250, in main self.run_cmd(cfg, options) File "/usr/lib/python2.7/site-packages/alembic/config.py", line 241, in run_cmd dict((k, getattr(options, k)) for k in kwarg) File "/usr/lib/python2.7/site-packages/alembic/command.py", line 148, in downgrade script.run_env() File "/usr/lib/python2.7/site-packages/alembic/script.py", line 191, in run_env util.load_python_file(self.dir, 'env.py') File "/usr/lib/python2.7/site-packages/alembic/util.py", line 185, in load_python_file module = imp.load_source(module_id, path, open(path, 'rb')) File "alembic/env.py", line 70, in <module> run_migrations_online() File "alembic/env.py", line 63, in run_migrations_online context.run_migrations() File "<string>", line 7, in run_migrations File "/usr/lib/python2.7/site-packages/alembic/environment.py", line 494, in run_migrations self.get_context().run_migrations(kw) File "/usr/lib/python2.7/site-packages/alembic/migration.py", line 211, in run_migrations change(**kw) TypeError: downgrade() takes exactly 1 argument (0 given)

I get the same traceback if I use the prefix of any filename in alembic/versions as the argument to "alembic downgrade"

Comments (7)

  1. Mike Bayer

    did you modify your script.py.mako to receive positional arguments within the downgrade() function ? only keyword arguments are supported.

    edit: i misstated this, i meant, you need to pass keyword arguments to context.run_migrations() if you've specified arguments in your downgrade().

  2. David Ripton

    (Reply via dri...@ripton.net):

    Aha! My downgrade function (which was converted from a sqlalchemy-migrate downgrade function) took an argument, which is not allowed. Sorry, my bug not yours.

  3. Log in to comment
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.