summaryrefslogtreecommitdiff
path: root/docs/tutorials/wiki2/src/basiclayout/setup.py
diff options
context:
space:
mode:
authorChris Davies <mcd@daviesinc.com>2013-07-18 20:38:45 +0000
committerChris Davies <mcd@daviesinc.com>2013-07-18 20:38:45 +0000
commit832067458dd92dd6543e7f3850bb447a09d895fa (patch)
treed742817f6cd8665e9bd755ab6741129b63c53cd9 /docs/tutorials/wiki2/src/basiclayout/setup.py
parentf57d764b2a53c52dcd5518f86beca99eb4690ecd (diff)
downloadpyramid-832067458dd92dd6543e7f3850bb447a09d895fa.tar.gz
pyramid-832067458dd92dd6543e7f3850bb447a09d895fa.tar.bz2
pyramid-832067458dd92dd6543e7f3850bb447a09d895fa.zip
When running the alchemy scaffold on MySQL an error is generated on table
creation: sqlalchemy.exc.OperationalError: (OperationalError) (1170, "BLOB/TEXT column 'name' used in key specification without a key length") '\nCREATE TABLE models (\n\tid INTEGER NOT NULL AUTO_INCREMENT, \n\tname TEXT, \n\tvalue INTEGER, \n\tPRIMARY KEY (id), \n\tUNIQUE (name)\n)\n\n' () MySQL (and MariaDB) doesn't allow an index of more than 255 characters. After modifying the scaffold and creating a project, the following results: > show create table models; +--------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Table | Create Table | +--------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | models | CREATE TABLE `models` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` text, `value` int(11) DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `my_index` (`name`(255)) ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 | +--------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ A unique index is created on the name field, constrained to 255 characters. When run on SQLite3: sqlite> .schema models CREATE TABLE models ( id INTEGER NOT NULL, name TEXT, value INTEGER, PRIMARY KEY (id) ); CREATE UNIQUE INDEX my_index ON models (name); the mysql specific constraint is ignored and the table is created with a unique index as desired.
Diffstat (limited to 'docs/tutorials/wiki2/src/basiclayout/setup.py')
0 files changed, 0 insertions, 0 deletions