MySQL 1071 Error when using alembic autogenerate from SQLAlchemy models

155 views
Skip to first unread message

Lance Blais

unread,
Oct 8, 2014, 1:32:26 PM10/8/14
to sqlalchem...@googlegroups.com

I have an existing Flask based Python 3.3 project and I'm trying to set it up to use Alembic.

I've followed the instructions and modified env.py as directed in various places. When I run `alembic revision --autogenerate -m 'test' `, I get a proper list of all my models.

After that, I run `alembic upgrade head` and I get the following MySQL error:

sqlalchemy.exc.InternalError: (InternalError) (1071, 'Specified key was too long; max key length is 767 bytes') b'\nCREATE TABLE hashed_links (\n\t`key` VARCHAR(256) NOT NULL, \n\tlink TEXT NOT NULL, \n\tPRIMARY KEY (`key`)\n)\n\n' ()

Can anyone tell me if there's something I've misconfigured or what to do to look deeper into this issue?

The database is MySQL 5.6, the default engine is InnoDB and I've ensured that all permissions are correctly set. The database itself is fresh (drop database; create database) whenever I try something new, so I'm hoping that gets all the trivial debug steps out of the way.

Thank you!

Michael Bayer

unread,
Oct 8, 2014, 1:57:38 PM10/8/14
to sqlalchem...@googlegroups.com
the first hit on google for this is a stack overflow answer that points to the relevant details for this message:


the size of the index is being impacted by the character encoding in use; see the links above for more details/workarounds.




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

Reply all
Reply to author
Forward
0 new messages