[web2py] problem with 1.77.3 & 1.78.3 and legacy database

13 views
Skip to first unread message

drayco

unread,
May 17, 2010, 7:31:25 PM5/17/10
to web2py-users
Hi, I updated my web2py, but I had a problem with web2py 1.78.3, I use
legacy databases. When I try to go to my application I got this

Error traceback

Traceback (most recent call last):
File "/media/RESPALDO/web2py/gluon/restricted.py", line 178, in
restricted
exec ccode in environment
File "/media/RESPALDO/web2py/applications/scada/models/
calenergy.py", line 8, in <module>
migrate = False)
File "/media/RESPALDO/web2py/gluon/sql.py", line 1296, in
define_table
**dict(primarykey=args['primarykey'], trigger_name=trigger_name,
sequence_name=sequence_name))
File "/media/RESPALDO/web2py/gluon/sql.py", line 2115, in __init__
raise SyntaxError, 'invalid table "%s" attribute: %s' %
(tablename, k)
SyntaxError: invalid table "area" attribute: sequence_name

In file: /media/RESPALDO/web2py/applications/scada/models/calenergy.py

calenergy=SQLDB('mysql://xxx:x...@127.0.0.1:3306/xxx',pool_size=10)

calenergy.define_table('area',
Field('clave', type = 'char' , length = 3 ),
Field('IdZona', type = 'integer' , length = 10 ),
Field('nombre', type = 'string' , length = 50 ),
primarykey=['clave','IdZona'],
migrate = False)

Even with web2py 1.77.3.

What this mean?

with my older version of web2py, I work well.

mdipierro

unread,
May 17, 2010, 8:33:29 PM5/17/10
to web2py-users
I am going to need your help in debugging this. In sql.py around lines
2115

for key in args:
if key not in [
'migrate',
'primarykey',
'fake_migrate',
'format',
'trigger_name',
'sequence_name']:
raise SyntaxError, 'invalid table "%s" attribute: %s' %
(tablename, key)

Somehow the last lines raises this exception:

SyntaxError: invalid table "area" attribute: sequence_name

but sequence_name is in the list above so the exception should not be
raised.

Any idea?

Russ Ferriday

unread,
May 17, 2010, 9:02:11 PM5/17/10
to web...@googlegroups.com
Can you check that there is not a space at the end of key.

Maybe change to :

raise SyntaxError, 'invalid table "%s" attribute: "%s"' % (tablename, key)

and look for garbage in the the result?
--r
Russ Ferriday - Topia Systems - Open Source content management with Plone and Zope
ru...@topia.com - mobile: +1 805 234 6915 - skype: ferriday

DenesL

unread,
May 17, 2010, 9:54:36 PM5/17/10
to web2py-users
On May 17, 6:31 pm, drayco <antrod...@gmail.com> wrote:
I am surprised to hear that it did work before because mysql is not
one of the supported DBs for legacy tables; only DB2, MS SQL, Ingres
or Informix.

But adding the support for them is not hard, you can follow the
instructions given in section E (the last section) of
http://groups.google.com/group/web2py/msg/c9848792a8999c5f
same with any other unsupported DB engine, except sqlite which I
believe lacks the required foreign keys constructs.

Denes.

mdipierro

unread,
May 17, 2010, 10:12:26 PM5/17/10
to web2py-users
still the error he is getting makes no sense to me.
> instructions given in section E (the last section) ofhttp://groups.google.com/group/web2py/msg/c9848792a8999c5f

DenesL

unread,
May 18, 2010, 10:16:18 AM5/18/10
to web2py-users
I am not sure what 'sequence_number' is used for and I don't recall
seeing it when I wrote the keyed table support, there is also somebody
else having a problem with it now: http://groups.google.com/group/web2py/msg/d9d11284a1e83a3e

Maybe it is not properly integrated with the keyed table part, just a
guess.

mdipierro

unread,
May 18, 2010, 11:47:01 AM5/18/10
to web2py-users
It is possible. But do you understand how it is possible that the
exception is raised? I do not see how it can happen.

drayco

unread,
May 18, 2010, 1:42:49 PM5/18/10
to web2py-users
Good afternoon everyone:

I hope this serves as something:

With version 1.76.5b everything works fine.

I reviewed the differences in the code of sql.py with versions 1.77_3
and 1.78.3.

I do not find any problem with code.

Anyway, I don't have a lot experience with python.

DenesL you got another test passed.

On 18 mayo, 10:47, mdipierro <mdipie...@cs.depaul.edu> wrote:
> It is possible. But do you understand how it is possible that the
> exception is raised? I do not see how it can happen.
>
> On May 18, 9:16 am, DenesL <denes1...@yahoo.ca> wrote:
>
> > I am not sure what 'sequence_number' is used for and I don't recall
> > seeing it when I wrote the keyed table support, there is also somebody
> > else having a problem with it now:http://groups.google.com/group/web2py/msg/d9d11284a1e83a3e
>
> > Maybe it is not properly integrated with the keyed table part, just a
> > guess.
>
> > On May 17, 10:12 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
>
> > > still the error he is getting makes no sense to me.
>
> > > On May 17, 8:54 pm, DenesL <denes1...@yahoo.ca> wrote:
>
> > > > On May 17, 6:31 pm, drayco <antrod...@gmail.com> wrote:
>
> > > > > Hi, I updated my web2py, but I had a problem with web2py 1.78.3, I use
> > > > >legacydatabases. When I try to go to my application I got this
> > > > one of the supported DBs forlegacytables; only DB2, MS SQL, Ingres

Nico de Groot

unread,
May 18, 2010, 5:47:41 PM5/18/10
to web2py-users
Massimo,

The error originates from 2115, but you are showing below other
(correct) lines of code (line 1253 and further). I think I documented
the error and the solution in http://groups.google.com/group/web2py/msg/d9d11284a1e83a3e
, wil send you the patch separately.

Nico de Groot
> > with my older version of web2py, I work well.- Tekst uit oorspronkelijk bericht niet weergeven -
>
> - Tekst uit oorspronkelijk bericht weergeven -

mdipierro

unread,
May 18, 2010, 5:59:57 PM5/18/10
to web2py-users
thank you. :-)

On May 18, 4:47 pm, Nico de Groot <ndegr...@chello.nl> wrote:
> Massimo,
>
> The error originates from 2115, but you are showing below other
> (correct) lines of code (line 1253 and further). I think I documented
> the error and the solution inhttp://groups.google.com/group/web2py/msg/d9d11284a1e83a3e
Reply all
Reply to author
Forward
0 new messages