Ok, We change to sexoworked and we got this
Traceback (most recent call last):
File "/home/drayco/web2py/gluon/restricted.py", line 189, in
restricted
exec ccode in environment
File "/home/drayco/web2py/applications/init/models/db.py", line 334,
in <module>
Field('subdireccion','string',requires=IS_IN_SET(['Nezahualcóyotl
y Chalco','Ecatepec y Tecámac','Cuautitlán Izcalli y
Naucalpan']),label='Trabajador SubDir.'),fake_migrate=True)
File "/home/drayco/web2py/gluon/dal.py", line 3973, in define_table
polymodel=polymodel)
File "/home/drayco/web2py/gluon/dal.py", line 611, in create_table
fake_migrate=fake_migrate)
File "/home/drayco/web2py/gluon/dal.py", line 655, in migrate_table
and not isinstance(table[key].type, SQLCustomType) \
File "/home/drayco/web2py/gluon/dal.py", line 4323, in __getitem__
return dict.__getitem__(self, str(key))
KeyError: 'nivel_educativo'
If not too much trouble, could you give other advice?
On Mar 31, 1:34 pm, Massimo Di Pierro <[email protected]>
wrote:
> Did you also change the case in the model to make sure the same case
> is used consistently?
>
> On Mar 31, 2:29 pm, drayco <[email protected]> wrote:
>
>
>
>
>
>
>
> > Thanks.
>
> > We put fake_migrate = True at all and we got it define_table
>
> > Traceback (most recent call last):
> > File "/home/drayco/web2py/gluon/restricted.py", line 189, in
> > restricted
> > exec ccode in environment
> > File "/home/drayco/web2py/applications/init/models/db.py", line 334,
> > in <module>
> > Field('subdireccion','string',requires=IS_IN_SET(['Nezahualcóyotl
> > y Chalco','Ecatepec y Tecámac','Cuautitlán Izcalli y
> > Naucalpan']),label='Trabajador SubDir.'),fake_migrate=True)
> > File "/home/drayco/web2py/gluon/dal.py", line 3973, in define_table
> > polymodel=polymodel)
> > File "/home/drayco/web2py/gluon/dal.py", line 611, in create_table
> > fake_migrate=fake_migrate)
> > File "/home/drayco/web2py/gluon/dal.py", line 655, in migrate_table
> > and not isinstance(table[key].type, SQLCustomType) \
> > File "/home/drayco/web2py/gluon/dal.py", line 4323, in __getitem__
> > return dict.__getitem__(self, str(key))
> > KeyError: 'sexoworked'
>
> > We place above some similar cases in which they had resolved, this is
> > the
> > linkhttp://groups.google.com/group/web2py/browse_thread/thread/b7388100e2...
>
> > If not too much trouble, could you give other advice?
>
> > On Mar 31, 1:06 pm, Massimo Di Pierro <[email protected]>
> > wrote:
>
> > > if mysql is not in case sensitive model, you just set all
> > > define_table(...,fake_migrate=True), make sure the table and fields
> > > are consistent everywhere, run it once (the .table will be rebuilt)
> > > and than remove the fake_migrate=True from the define_tables.
>
> > > On Mar 31, 2:00 pm, drayco <[email protected]> wrote:
>
> > > > Sorry, my bad, I view other older db.
>
> > > > well, this is my true
>
> > > > We have reviewed and xxxxbenefs2.table SQL.LOG and we observe that the
> > > > field sexoWorked is defined according to the model.
>
> > > > We have reviewed all our model,controllers and views and we observe
> > > > that the field sexoWorked is refer according to the model
>
> > > > And when reviewing the MySQL database we see that the field is
> > > > defined as sexoWorked.
>
> > > > Any advice?
>
> > > > On Mar 31, 12:47 pm, drayco <[email protected]> wrote:
>
> > > > > Please, we want you to help us confirm
>
> > > > > We have reviewed and xxxxbenefs2.table SQL.LOG and we observe that the
> > > > > field sexoWorked is defined according to the model.
>
> > > > > However, when reviewing the MySQL database we see that the field is
> > > > > defined as sexoworked. As you say
>
> > > > > In this case it would be best to migrate all the code, model,
> > > > > controllers and views?
>
> > > > > We would have to change and xxxbenefs2.table SQL.LOG manually?
>
> > > > > Or is there another alternative?
> > > > > On Mar 31, 12:17 pm, Massimo Di Pierro <[email protected]>
> > > > > wrote:
>
> > > > > > The problem is this:
>
> > > > > > You defined Field('sexoWorked')
>
> > > > > > but you are using "sexoworked" in your code. Some versions of web2py
> > > > > > were forgiving about that but it resulted in a problem because SQL
> > > > > > is
> > > > > > not always case agnostic. You need to make sure you use the same
> > > > > > case
> > > > > > in the table definitions and in the code.
>
> > > > > > Attention: if you change the case in models that may trigger a
> > > > > > migration and data loss unless you convert the .table files. I will
> > > > > > be
> > > > > > happy to do that for you if needed.
>
> > > > > > Massimo
>
> > > > > > On Mar 31, 1:03 pm, drayco <[email protected]> wrote:
>
> > > > > > > Good morning to all, our case is as follows, in the production
> > > > > > > site
> > > > > > > have web2py 1.89.5 and MySQL, all our applications are operating
> > > > > > > properly.
>
> > > > > > > Now we would like to upgrade to version 1.94.6, however we have
> > > > > > > compatibility issues with the new version of the dal, these are
> > > > > > > the
> > > > > > > details.
>
> > > > > > > db.define_table('benefs2',
> > > > > > > Field('names', 'string',
> > > > > > > requires=[IS_UPPER(),IS_NOT_EMPTY(error_message='No puede estar
> > > > > > > vacio')], label='Benef. Nombre(s)'),
> > > > > > > Field('apelPater', 'string',
> > > > > > > requires=[IS_UPPER(),IS_NOT_EMPTY(error_message='No puede estar
> > > > > > > vacio')], label='Benef. Apel. Pater.'),
> > > > > > > Field('apelMater', 'string',
> > > > > > > requires=[IS_UPPER(),IS_NOT_EMPTY(error_message='No puede estar
> > > > > > > vacio')], label='Benef. Apel. Mater.'),
> > > > > > > Field('rfc', 'string', requires=[IS_UPPER(),
> > > > > > > IS_NOT_EMPTY(error_message='No puede estar vacio'),\
> > > > > > > IS_LENGTH(13,error_message='El tamaño debe ser de 13
> > > > > > > caracteres alfanumericos'),IS_ALPHANUMERIC(error_message='¡Deben
> > > > > > > ser
> > > > > > > caracteres alfanumericos!'), \
> > > > > > > IS_NOT_IN_DB(db,'benefs2.rfc',error_message='El RFC ya
> > > > > > > existe')], label='Benef. RFC'),
>
> > > > > > > Field('sexo','string',requires=IS_IN_SET(['femenino','masculino']),
> > > > > > > label='Benef. Sexo'),
>
> > > > > > > Field('enfermedades',db.enfermedades,requires=IS_IN_DB(db,'enfermedades.id'
> > > > > > > ,'%
> > > > > > > (names)s'), label='Benef. Enfermedad',readable=False),
> > > > > > > Field('namesWorked', 'string',
> > > > > > > requires=[IS_UPPER(),IS_NOT_EMPTY(error_message='No puede estar
> > > > > > > vacio')], label='Trabajador Nombre(s)'),
> > > > > > > Field('apelPaterWorked', 'string',
> > > > > > > requires=[IS_UPPER(),IS_NOT_EMPTY(error_message='No puede estar
> > > > > > > vacio')], label='Trabajador Apel.Pater.'),
> > > > > > > Field('apelMaterWorked', 'string',
> > > > > > > requires=[IS_UPPER(),IS_NOT_EMPTY(error_message='No puede estar
> > > > > > > vacio')], label='Trabajador Apel.Mater.'),
> > > > > > > Field('rfcWorked', 'string', requires=[IS_UPPER(),
> > > > > > > IS_NOT_EMPTY(error_message='No puede estar vacio'),\
> > > > > > > IS_LENGTH(13,error_message='El tamaño debe ser de 13
> > > > > > > caracteres alfanumericos'),IS_ALPHANUMERIC(error_message='¡Deben
> > > > > > > ser
> > > > > > > caracteres alfanumericos!'), \
> > > > > > > IS_NOT_IN_DB(db,'benefs2.rfcWorked',error_message='El RFC
> > > > > > > ya
> > > > > > > existe')], label='Trabajador RFC'),
> > > > > > > IS_FLOAT_IN_RANGE(0,1e1000,error_message='Debe ser Numero
> > > > > > > positivo')],
> > > > > > > label='Trabajador Tel.Trabajo'),
>
> > > > > > > Field('sexoWorked','string',requires=IS_IN_SET(['femenino','masculino']),
> > > > > > > label='Trabajador Sexo'),
> > > > > > >
> > > > > > > Field('subdireccion','string',requires=IS_IN_SET(['Nezahualcóyotl
> > > > > > > y Chalco','Ecatepec y Tecámac','Cuautitlán Izcalli y
> > > > > > > Naucalpan']),label='Trabajador SubDir.'))
>
> > > > > > > Could you help?, thanks in advance for your excellent work.
>
> > > > > > > Traceback (most recent call last):
> > > > > > > File "/home/drayco/web2py/gluon/restricted.py", line 189, in
> > > > > > > restricted
> > > > > > > exec ccode in environment
> > > > > > > File "/home/drayco/web2py/applications/init/models/db.py", line
> > > > > > > 334,
> > > > > > > in <module>
> > > > > > >
> > > > > > > Field('subdireccion','string',requires=IS_IN_SET(['Nezahualcóyotl
> > > > > > > y Chalco','Ecatepec y Tecámac','Cuautitlán Izcalli y
> > > > > > > Naucalpan']),label='Trabajador SubDir.'))
> > > > > > > File "/home/drayco/web2py/gluon/dal.py", line 3973, in
> > > > > > > define_table
> > > > > > > polymodel=polymodel)
> > > > > > > File "/home/drayco/web2py/gluon/dal.py", line 611, in
> > > > > > > create_table
> > > > > > > fake_migrate=fake_migrate)
> > > > > > > File "/home/drayco/web2py/gluon/dal.py", line 655, in
> > > > > > > migrate_table
> > > > > > > and not isinstance(table[key].type, SQLCustomType) \
> > > > > > > File "/home/drayco/web2py/gluon/dal.py", line 4323, in
> > > > > > > __getitem__
> > > > > > > return dict.__getitem__(self, str(key))
> > > > > > > KeyError: 'sexoworked'
>
> > > > > > > Code listing
>
> > > > > > > 4318.
> > > > > > > 4319.
> > > > > > > 4320.
> > > > > > > 4321.
> > > > > > > 4322.
> > > > > > > 4323.
>
> > > > > > > 4324.
> > > > > > > 4325.
> > > > > > > 4326.
> > > > > > > 4327.
> > > > > > > return rows[0]
> > > > > > > return None
> > > > > > > elif str(key).isdigit():
> > > > > > > return self._db(self.id ==
> > > > > > > key).select(limitby=(0,1)).first()
> > > > > > > elif key:
> > > > > > > return dict.__getitem__(self, str(key))
>
> > > > > > > def __call__(self, key=DEFAULT, **kwargs):
> > > > > > > if key!=DEFAULT:
> > > > > > > if isinstance(key, Query):