[web2py] Re: Using DB on Module (thread)

2012-05-08 Thread Samuel Mac
If I define de DAL in __init__ and make a query in the constructor (just for trying), it works. But it doesn't on the run method, I can not make any query outside the constructor. *Solved:* I have to define the DAL in the run method again. I dont know why but now it works. def run(self):

[web2py] Re: Using DB on Module (thread)

2012-05-08 Thread Anthony
> > I've added this line in my code: > > db = DAL('mysql://mydatabase', > folder='applications/gestion/databases',auto_import > =True) > > But the result was the same I got at the beginig: > > raise errorclass, errorvalue > InterfaceError: (0, '') > Are you saying if you take away the f

[web2py] Re: Using DB on Module (thread)

2012-05-08 Thread Samuel Mac
I've added this line in my code: db = DAL('mysql://mydatabase', folder='applications/gestion/databases',auto_import =True) But the result was the same I got at the beginig: raise errorclass, errorvalue InterfaceError: (0, '') El lunes, 7 de mayo de 2012 12:21:17 UTC+2, Samuel Mac es

[web2py] Re: Using DB on Module (thread)

2012-05-07 Thread Anthony
> > *from gluon.sql import DAL, Field* > *db = DAL('mysql:mydatabase')* > > Done. But it seems to be empty, no tables remaining :( > Even if I select the auth_user table: "*KeyError: 'auth_user*'" > After defining the "db" object, you have to define the tables as well -- otherwise, it doesn't kn

[web2py] Re: Using DB on Module (thread)

2012-05-07 Thread Samuel Mac
Ok Massimo. Ty *from gluon.sql import DAL, Field* *db = DAL('mysql:mydatabase')* Done. But it seems to be empty, no tables remaining :( Even if I select the auth_user table: "*KeyError: 'auth_user*'" Should i get other information from gluon? I thinked using 3 threads was the best way obtaining

[web2py] Re: Using DB on Module (thread)

2012-05-07 Thread Massimo Di Pierro
You cannot have multiple threads share the same db. That conflicts with web2py thread pooling mechanism. Even if it did not, we do not know the db driver it thread safe. Each thread must have it's own db=DAL() connection. On Monday, 7 May 2012 05:21:17 UTC-5, Samuel Mac wrote: > > First of all,