root@luck:/home/Documents# alembic upgrade head INFO [alembic.migration] Context impl MySQLImpl. INFO [alembic.migration] Will assume non-transactional DDL. INFO [alembic.migration] Running upgrade None -> d28a086e79d Traceback (most recent call last): File "/usr/local/bin/alembic", line 9, in <module> load_entry_point('alembic==0.4.0', 'console_scripts', 'alembic')() File "/usr/local/lib/python2.7/dist-packages/alembic/config.py", line 255, in main CommandLine(prog=prog).main(argv=argv) File "/usr/local/lib/python2.7/dist-packages/alembic/config.py", line 250, in main self.run_cmd(cfg, options) File "/usr/local/lib/python2.7/dist-packages/alembic/config.py", line 241, in run_cmd **dict((k, getattr(options, k)) for k in kwarg) File "/usr/local/lib/python2.7/dist-packages/alembic/command.py", line 124, in upgrade script.run_env() File "/usr/local/lib/python2.7/dist-packages/alembic/script.py", line 191, in run_env util.load_python_file(self.dir, 'env.py') File "/usr/local/lib/python2.7/dist-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 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 "/usr/local/lib/python2.7/dist-packages/alembic/environment.py", line 494, in run_migrations self.get_context().run_migrations(**kw) File "/usr/local/lib/python2.7/dist-packages/alembic/migration.py", line 211, in run_migrations change(**kw) File "alembic/versions/removelater.py", line 32, in upgrade mysql_ENGINE='InnoDB' File "<string>", line 7, in create_table File "/usr/local/lib/python2.7/dist-packages/alembic/operations.py", line 574, in create_table self._table(name, *columns, **kw) File "/usr/local/lib/python2.7/dist-packages/alembic/ddl/impl.py", line 148, in create_table self._exec(schema.CreateTable(table)) File "/usr/local/lib/python2.7/dist-packages/alembic/ddl/impl.py", line 75, in _exec conn.execute(construct, *multiparams, **params) File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 664, in execute params) File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 723, in _execute_ddl compiled File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 878, in _execute_context context) File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 871, in _execute_context context) File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/default.py", line 320, in do_execute cursor.execute(statement, parameters) File "/usr/lib/python2.7/dist-packages/MySQLdb/cursors.py", line 174, in execute self.errorhandler(self, exc, value) File "/usr/lib/python2.7/dist-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler raise errorclass, errorvalue sqlalchemy.exc.OperationalError: (OperationalError) (1005, "Can't create table 'saintdb2.mytest1' (errno: 150)") '\nCREATE TABLE mytest1 (\n\tid INTEGER NOT NULL AUTO_INCREMENT, \n\tname VARCHAR(80) NOT NULL, \n\ttype_id INTEGER, \n\ttelephone TEXT, \n\tcontactname VARCHAR(45) NOT NULL, \n\tPRIMARY KEY (id), \n\tFOREIGN KEY(type_id) REFERENCES mytest (id), \n\tUNIQUE (name)\n)ENGINE=InnoDB DEFAULT CHARSET=ascii\n\n' ()
--- when removed foreignkey constraint, then got below: root@luck:/home/Documents# alembic upgrade head INFO [alembic.migration] Context impl MySQLImpl. INFO [alembic.migration] Will assume non-transactional DDL. INFO [alembic.migration] Running upgrade None -> d28a086e79d Hope the output is helpful for your diagnosis of my issue. Thanks a lot. -- 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?hl=en. For more options, visit https://groups.google.com/groups/opt_out.