Re: [web2py] 1071, 'Specified key was too long; max key length is 767 bytes'

2013-10-09 Thread Mark Li
Just wanted to chime in on this.

For me, I had to add a "length=255" to all my "unique=True" fields, even 
after adding length=255 for the "string" fields.

On Wednesday, October 9, 2013 11:46:48 AM UTC-7, Niphlod wrote:
>
> sorry for being late. This is from web2py's 2.6.0 changelog.
>
> Attention MySQL users: The length of string fields changed from 255 to 512 
> bytes. If you have migrations enabled this will trigger a large migration. 
> To prevent it, first set migrate_enabled=False, upgrade, check everything 
> is ok, then add length=255 to your string Fields, then re-enable migrations 
> with migrate_enabled=True if needed.
>
> tl;dr: remember to ALWAYS set length= for strings.
>
> tl;dr n.2 : Mysql has huge issues. One of them is that you can't index a 
> too large column. 
>
>
> On Wednesday, October 9, 2013 9:25:51 AM UTC+2, Gwayne aka Mike Veltman 
> wrote:
>>
>>   
>>
>> I found it. 
>>
>>  
>>
>> It was in db.py
>>
>>  
>>
>> db.define_table('frame',
>>
>>  
>>
>> Field('framename', type='string',
>>
>> # #unique=True, < 
>> the problem. Is it a bug ?
>>
>> label=T('Framename')),
>>
>> Field('description', type='string',
>>
>> label=T('Description')),
>>
>> Field('netboot', type='string',default="None",
>>
>> label=T('Netboot information')),
>>
>> Field('ip', type='string',
>>
>> #unique=True,
>>
>> label=T('IP Address')),
>>
>> Field('servermodel', type='string',default="p6",
>>
>> label=T('Server model')),
>>
>> Field('serial', type='string',default="None",
>>
>> label=T('Serial Number')),
>>
>> Field('lvname', type='string',default="FRAMEx",
>>
>> label=T('Frame extension for storage logical volumes')),
>>
>> Field('framestaterecord_ID', type='integer',
>>
>> label=T('Frame State record ID')),
>>
>> Field('created_on','datetime',default=request.now,
>>
>> label=T('Created On'),writable=False,readable=False),
>>
>> Field('modified_on','datetime',default=request.now,
>>
>> label=T('Modified On'),writable=False,readable=False,
>>
>> update=request.now),
>>
>> format='%(framename)s',
>>
>> migrate=True)
>>
>>  
>>
>>  
>>
>>  
>>
>> On Tuesday 08 October 2013 13:41:31 Mike Veltman wrote:
>>
>> Ok, I am now fighting with it for two days and it drives me crazy.
>>
>> My gut feeling says mysql 5.1 --> mysql 5.5 upgrade is the cause. Am I 
>> right ? And how do I solve it. :-)
>>
>>  
>>
>> Error ticket for "adeploy"
>>
>> Ticket ID
>>
>> 192.168.2.106.2013-10-08.12-46-19.24f3f1a5-d637-4522-965b-fed4958115ed
>>
>>  (1071, 'Specified key was 
>> too long; max key length is 767 bytes')
>>
>> Version
>>   
>> web2py™
>>  
>> Version 2.7.2-stable+timestamp.2013.10.07.13.52.24
>>
>> Traceback
>>
>>  
>>   
>> 1.
>> 2.
>> 3.
>> 4.
>> 5.
>> 6.
>> 7.
>> 8.
>> 9.
>> 10.
>> 11.
>> 12.
>> 13.
>> 14.
>> 15.
>> 16.
>> 17.
>> 18.
>> 19.
>> 20.
>> 21.
>> 22.
>>  
>> Traceback (most recent call last):
>> File "/srv/web-apps/web2py/gluon/restricted.py", line 217, in restricted
>> exec ccode in environment
>> File "/srv/web-apps/web2py/applications/adeploy/compiled/models/db.py", line 
>> 178, in 
>> File "/srv/web-apps/web2py/gluon/dal.py", line 7911, in define_table
>> table = self.lazy_define_table(tablename,*fields,**args)
>> File "/srv/web-apps/web2py/gluon/dal.py", line 7948, in lazy_define_table
>> polymodel=polymodel)
>> File "/srv/web-apps/web2py/gluon/dal.py", line 1029, in create_table
>> fake_migrate=fake_migrate)
>> File "/srv/web-apps/web2py/gluon/dal.py", line 1136, in migrate_table
>> self.execute(sub_query)
>> File "/srv/web-apps/web2py/gluon/dal.py", line 1836, in execute
>> return self.log_execute(*a, **b)
>> File "/srv/web-apps/web2py/gluon/dal.py", line 1830, in log_execute
>> ret = self.cursor.execute(command, *a[1:], **b)
>> File "/usr/lib64/python2.6/site-packages/MySQLdb/cursors.py", line 173, in 
>> execute
>> self.errorhandler(self, exc, value)
>> File "/usr/lib64/python2.6/site-packages/MySQLdb/connections.py", line 36, 
>> in defaulterrorhandler
>> raise errorclass, errorvalue
>> OperationalError: (1071, 'Specified key was too long; max key length is 
>> 767 bytes')
>>
>> In file: /srv/web-apps/web2py/applications/adeploy/compiled/models/db.pyc
>>   
>> 1.
>>  
>>  at 0x168c468, file 
>> "/srv/web-apps/web2py/applications/adeploy/compiled/models/db.py", line 
>> 28>
>>
>>  
>>
>>  
>>
>>
>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] 1071, 'Specified key was too long; max key length is 767 bytes'

2013-10-09 Thread Niphlod
sorry for being late. This is from web2py's 2.6.0 changelog.

Attention MySQL users: The length of string fields changed from 255 to 512 
bytes. If you have migrations enabled this will trigger a large migration. 
To prevent it, first set migrate_enabled=False, upgrade, check everything 
is ok, then add length=255 to your string Fields, then re-enable migrations 
with migrate_enabled=True if needed.

tl;dr: remember to ALWAYS set length= for strings.

tl;dr n.2 : Mysql has huge issues. One of them is that you can't index a 
too large column. 


On Wednesday, October 9, 2013 9:25:51 AM UTC+2, Gwayne aka Mike Veltman 
wrote:
>
>   
>
> I found it. 
>
>  
>
> It was in db.py
>
>  
>
> db.define_table('frame',
>
>  
>
> Field('framename', type='string',
>
> # #unique=True, < 
> the problem. Is it a bug ?
>
> label=T('Framename')),
>
> Field('description', type='string',
>
> label=T('Description')),
>
> Field('netboot', type='string',default="None",
>
> label=T('Netboot information')),
>
> Field('ip', type='string',
>
> #unique=True,
>
> label=T('IP Address')),
>
> Field('servermodel', type='string',default="p6",
>
> label=T('Server model')),
>
> Field('serial', type='string',default="None",
>
> label=T('Serial Number')),
>
> Field('lvname', type='string',default="FRAMEx",
>
> label=T('Frame extension for storage logical volumes')),
>
> Field('framestaterecord_ID', type='integer',
>
> label=T('Frame State record ID')),
>
> Field('created_on','datetime',default=request.now,
>
> label=T('Created On'),writable=False,readable=False),
>
> Field('modified_on','datetime',default=request.now,
>
> label=T('Modified On'),writable=False,readable=False,
>
> update=request.now),
>
> format='%(framename)s',
>
> migrate=True)
>
>  
>
>  
>
>  
>
> On Tuesday 08 October 2013 13:41:31 Mike Veltman wrote:
>
> Ok, I am now fighting with it for two days and it drives me crazy.
>
> My gut feeling says mysql 5.1 --> mysql 5.5 upgrade is the cause. Am I 
> right ? And how do I solve it. :-)
>
>  
>
> Error ticket for "adeploy"
>
> Ticket ID
>
> 192.168.2.106.2013-10-08.12-46-19.24f3f1a5-d637-4522-965b-fed4958115ed
>
>  (1071, 'Specified key was too 
> long; max key length is 767 bytes')
>
> Version
>   
> web2py™
>  
> Version 2.7.2-stable+timestamp.2013.10.07.13.52.24
>
> Traceback
>
>  
>   
> 1.
> 2.
> 3.
> 4.
> 5.
> 6.
> 7.
> 8.
> 9.
> 10.
> 11.
> 12.
> 13.
> 14.
> 15.
> 16.
> 17.
> 18.
> 19.
> 20.
> 21.
> 22.
>  
> Traceback (most recent call last):
> File "/srv/web-apps/web2py/gluon/restricted.py", line 217, in restricted
> exec ccode in environment
> File "/srv/web-apps/web2py/applications/adeploy/compiled/models/db.py", line 
> 178, in 
> File "/srv/web-apps/web2py/gluon/dal.py", line 7911, in define_table
> table = self.lazy_define_table(tablename,*fields,**args)
> File "/srv/web-apps/web2py/gluon/dal.py", line 7948, in lazy_define_table
> polymodel=polymodel)
> File "/srv/web-apps/web2py/gluon/dal.py", line 1029, in create_table
> fake_migrate=fake_migrate)
> File "/srv/web-apps/web2py/gluon/dal.py", line 1136, in migrate_table
> self.execute(sub_query)
> File "/srv/web-apps/web2py/gluon/dal.py", line 1836, in execute
> return self.log_execute(*a, **b)
> File "/srv/web-apps/web2py/gluon/dal.py", line 1830, in log_execute
> ret = self.cursor.execute(command, *a[1:], **b)
> File "/usr/lib64/python2.6/site-packages/MySQLdb/cursors.py", line 173, in 
> execute
> self.errorhandler(self, exc, value)
> File "/usr/lib64/python2.6/site-packages/MySQLdb/connections.py", line 36, 
> in defaulterrorhandler
> raise errorclass, errorvalue
> OperationalError: (1071, 'Specified key was too long; max key length is 
> 767 bytes')
>
> In file: /srv/web-apps/web2py/applications/adeploy/compiled/models/db.pyc
>   
> 1.
>  
>  at 0x168c468, file 
> "/srv/web-apps/web2py/applications/adeploy/compiled/models/db.py", line 28
> >
>
>  
>
>  
>
>
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] 1071, 'Specified key was too long; max key length is 767 bytes'

2013-10-09 Thread Mike Veltman

I found it. 

It was in db.py

db.define_table('frame',

Field('framename', type='string',
#  #unique=True,
  < the problem. Is it 
a bug ?
  label=T('Framename')),
Field('description', type='string',
  label=T('Description')),
Field('netboot', type='string',default="None",
  label=T('Netboot information')),
Field('ip', type='string',
  #unique=True,
  label=T('IP Address')),
Field('servermodel', type='string',default="p6",
  label=T('Server model')),
Field('serial', type='string',default="None",
  label=T('Serial Number')),
Field('lvname', type='string',default="FRAMEx",
  label=T('Frame extension for storage logical volumes')),
Field('framestaterecord_ID', type='integer',
  label=T('Frame State record ID')),
Field('created_on','datetime',default=request.now,
  label=T('Created On'),writable=False,readable=False),
Field('modified_on','datetime',default=request.now,
  label=T('Modified On'),writable=False,readable=False,
  update=request.now),
format='%(framename)s',
migrate=True)



On Tuesday 08 October 2013 13:41:31 Mike Veltman wrote:


Ok, I am now fighting with it for two days and it drives me crazy.
My gut feeling says mysql 5.1 --> mysql 5.5 upgrade is the cause. Am I right ? 
And how do I solve it. :-)

*Error ticket for "adeploy"*
*Ticket ID*
192.168.2.106.2013-10-08.12-46-19.24f3f1a5-d637-4522-965b-fed4958115ed
* (1071, 'Specified key was too 
long; max key length is 767 bytes')*
*Version*
*web2py™*
Version 2.7.2-stable+timestamp.2013.10.07.13.52.24

*Traceback*

1.

Traceback *(*most recent call last*):  *File 
"/srv/web-apps/web2py/gluon/restricted.py"*, *line 217*, in *restricted
*exec *ccode *in *environment  File 
"/srv/web-apps/web2py/applications/adeploy/compiled/models/db.py"*, *line 178*, 
in <*module*>  *File "/srv/web-apps/web2py/gluon/dal.py"*, *line 7911*, in 
*define_tabletable *= 
**self.*lazy_define_table*(*tablename*,**fields*,***args*)  *File 
"/srv/web-apps/web2py/gluon/dal.py"*, *line 7948*, in *lazy_define_table
polymodel*=*polymodel*)  *File "/srv/web-apps/web2py/gluon/dal.py"*, *line 
1029*, in *create_tablefake_migrate*=*fake_migrate*)  *File 
"/srv/web-apps/web2py/gluon/dal.py"*, *line 1136*, in *migrate_table
*self.*execute*(*sub_query*)  *File "/srv/web-apps/web2py/gluon/dal.py"*, *line 
1836*, in *execute*return self.*log_execute*(**a*, ***b*)  *File 
"/srv/web-apps/web2py/gluon/dal.py"*, *line 1830*, in *log_executeret *= 
**self.*cursor*.*execute*(*command*, **a*[*1*:], ***b*)  *File 
"/usr/lib64/python2.6/site-packages/MySQLdb/cursors.py"*, *line 173*, in 
*execute*self.*errorhandler*(self, *exc*, *value*)  *File 
"/usr/lib64/python2.6/site-packages/MySQLdb/connections.py"*, *line 36*, in 
*defaulterrorhandler*raise *errorclass*, *errorvalueOperationalError*: 
(*1071*, *'Specified key was too long; max key length is 767 bytes'*)

*

*In file: /srv/web-apps/web2py/applications/adeploy/compiled/models/db.pyc*
1.
*<*code object *<*module*> *at 0x168c468*, *file 
"/srv/web-apps/web2py/applications/adeploy/compiled/models/db.py"*, *line 28*>*





-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] 1071, 'Specified key was too long; max key length is 767 bytes'

2013-10-07 Thread Mike Veltman
Ok, I am now fighting with it for two days and it drives me crazy.
My gut feeling says mysql 5.1 --> mysql 5.5 upgrade is the cause. Am I right ? 
And how do I solve it. :-)

*Error ticket for "adeploy"*
*Ticket ID*
192.168.2.106.2013-10-08.12-46-19.24f3f1a5-d637-4522-965b-fed4958115ed
* (1071, 'Specified key was too 
long; max key length is 767 bytes')*
*Version*
*web2py™*
Version 2.7.2-stable+timestamp.2013.10.07.13.52.24

*Traceback*

1.

Traceback *(*most recent call last*):  *File 
"/srv/web-apps/web2py/gluon/restricted.py"*, *line 217*, in *restricted
*exec *ccode *in *environment  File 
"/srv/web-apps/web2py/applications/adeploy/compiled/models/db.py"*, *line 178*, 
in <*module*>  *File "/srv/web-apps/web2py/gluon/dal.py"*, *line 7911*, in 
*define_tabletable *= 
**self.*lazy_define_table*(*tablename*,**fields*,***args*)  *File 
"/srv/web-apps/web2py/gluon/dal.py"*, *line 7948*, in *lazy_define_table
polymodel*=*polymodel*)  *File "/srv/web-apps/web2py/gluon/dal.py"*, *line 
1029*, in *create_tablefake_migrate*=*fake_migrate*)  *File 
"/srv/web-apps/web2py/gluon/dal.py"*, *line 1136*, in *migrate_table
*self.*execute*(*sub_query*)  *File "/srv/web-apps/web2py/gluon/dal.py"*, *line 
1836*, in *execute*return self.*log_execute*(**a*, ***b*)  *File 
"/srv/web-apps/web2py/gluon/dal.py"*, *line 1830*, in *log_executeret *= 
**self.*cursor*.*execute*(*command*, **a*[*1*:], ***b*)  *File 
"/usr/lib64/python2.6/site-packages/MySQLdb/cursors.py"*, *line 173*, in 
*execute*self.*errorhandler*(self, *exc*, *value*)  *File 
"/usr/lib64/python2.6/site-packages/MySQLdb/connections.py"*, *line 36*, in 
*defaulterrorhandler*raise *errorclass*, *errorvalueOperationalError*: 
(*1071*, *'Specified key was too long; max key length is 767 bytes'*)

*

*In file: /srv/web-apps/web2py/applications/adeploy/compiled/models/db.pyc*
1.
*<*code object *<*module*> *at 0x168c468*, *file 
"/srv/web-apps/web2py/applications/adeploy/compiled/models/db.py"*, *line 28*>*

 

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] 1071, 'Specified key was too long; max key length is 767 bytes

2013-10-07 Thread Mike Veltman


My gut feeling says mysql 5.1 --> mysql 5.5 upgrade is the cause. Am I right ? 
And how do I solve it. :-)

*Error ticket for "adeploy"*
*Ticket ID*
192.168.2.106.2013-10-08.12-46-19.24f3f1a5-d637-4522-965b-fed4958115ed
* (1071, 'Specified key was too 
long; max key length is 767 bytes')*
*Version*
*web2py™*
Version 2.7.2-stable+timestamp.2013.10.07.13.52.24

*Traceback*

1.

Traceback *(*most recent call last*):  *File 
"/srv/web-apps/web2py/gluon/restricted.py"*, *line 217*, in *restricted
*exec *ccode *in *environment  File 
"/srv/web-apps/web2py/applications/adeploy/compiled/models/db.py"*, *line 178*, 
in <*module*>  *File "/srv/web-apps/web2py/gluon/dal.py"*, *line 7911*, in 
*define_tabletable *= 
**self.*lazy_define_table*(*tablename*,**fields*,***args*)  *File 
"/srv/web-apps/web2py/gluon/dal.py"*, *line 7948*, in *lazy_define_table
polymodel*=*polymodel*)  *File "/srv/web-apps/web2py/gluon/dal.py"*, *line 
1029*, in *create_tablefake_migrate*=*fake_migrate*)  *File 
"/srv/web-apps/web2py/gluon/dal.py"*, *line 1136*, in *migrate_table
*self.*execute*(*sub_query*)  *File "/srv/web-apps/web2py/gluon/dal.py"*, *line 
1836*, in *execute*return self.*log_execute*(**a*, ***b*)  *File 
"/srv/web-apps/web2py/gluon/dal.py"*, *line 1830*, in *log_executeret *= 
**self.*cursor*.*execute*(*command*, **a*[*1*:], ***b*)  *File 
"/usr/lib64/python2.6/site-packages/MySQLdb/cursors.py"*, *line 173*, in 
*execute*self.*errorhandler*(self, *exc*, *value*)  *File 
"/usr/lib64/python2.6/site-packages/MySQLdb/connections.py"*, *line 36*, in 
*defaulterrorhandler*raise *errorclass*, *errorvalueOperationalError*: 
(*1071*, *'Specified key was too long; max key length is 767 bytes'*)

*

*In file: /srv/web-apps/web2py/applications/adeploy/compiled/models/db.pyc*
1.
*<*code object *<*module*> *at 0x168c468*, *file 
"/srv/web-apps/web2py/applications/adeploy/compiled/models/db.py"*, *line 28*>*

 


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] 1071, Specified key was too long; max key length is 767 bytes in 2.6.0-development+timestamp.2013.07

2013-08-03 Thread Adi
Upgraded from 2.5.1 to 2.6.0, and it seems that auth.wiki is causing this. 
If I comment it out, everything else works fine.

#auth.wiki(resolve=False)
#wiki = Wiki(auth=auth, render='html')


Ticket ID 

127.0.0.1.2013-08-03.08-03-20.34cb1611-c6d4-46fc-b59e-106ad21d723e
 (1071, u'Specified key 
was too long; max key length is 767 bytes') Version  web2py™ Version 
2.6.0-development+timestamp.2013.08.01.08.22.32  Traceback 

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.

Traceback (most recent call last):
  File "/Users/adnan/web2py24/gluon/restricted.py", line 212, in restricted
exec ccode in environment
  File "/Users/adnan/web2py24/applications/bsp/models/db.py" 
, line 84, in 

auth.wiki(resolve=False)
  File "/Users/adnan/web2py24/gluon/tools.py", line 3467, in wiki
function=function)
  File "/Users/adnan/web2py24/gluon/tools.py", line 5152, in __init__
db.define_table(key, *args, **value['vars'])
  File "/Users/adnan/web2py24/gluon/dal.py", line 7779, in define_table
table = self.lazy_define_table(tablename,*fields,**args)
  File "/Users/adnan/web2py24/gluon/dal.py", line 7816, in lazy_define_table
polymodel=polymodel)
  File "/Users/adnan/web2py24/gluon/dal.py", line 1021, in create_table
fake_migrate=fake_migrate)
  File "/Users/adnan/web2py24/gluon/dal.py", line 1126, in migrate_table
self.execute(sub_query)
  File "/Users/adnan/web2py24/gluon/dal.py", line 1816, in execute
return self.log_execute(*a, **b)
  File "/Users/adnan/web2py24/gluon/dal.py", line 1810, in log_execute
ret = self.cursor.execute(command, *a[1:], **b)
  File "/Users/adnan/web2py24/gluon/contrib/pymysql/cursors.py", line 117, in 
execute
self.errorhandler(self, exc, value)
  File "/Users/adnan/web2py24/gluon/contrib/pymysql/connections.py", line 202, 
in defaulterrorhandler
raise errorclass, errorvalue
InternalError: (1071, u'Specified key was too long; max key length is 767 
bytes')


-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.