I think I fixed this in trunk. Please check.
On Jun 6, 2:25 pm, apple <simo...@gmail.com> wrote: > I ran that (assuming you meant refer to the databases folder). However > it gives an error: > > Traceback (most recent call last): > File "C:\web2py\applications\crm\controllers\querytest.py", line 4, > in <module> > db = DAL('sqlite://storage.sqlite', folder='c:/web2py/applications/ > crm/databases', auto_import=True) > File "c:/web2py\gluon\dal.py", line 3903, in __init__ > self.import_table_definitions(adapter.folder) > File "c:/web2py\gluon\dal.py", line 3913, in > import_table_definitions > mf.sort() > File "c:/web2py\gluon\dal.py", line 4919, in __eq__ > return Query(self.db, self.db._adapter.EQ, self, value) > AttributeError: 'NoneType' object has no attribute '_adapter' > > On Jun 6, 8:14 pm, Massimo Di Pierro <massimo.dipie...@gmail.com> > wrote: > > > > > > > > > import sys > > sys.path.append("c:/web2py") > > from gluon import * > > > db = DAL('sqlite://...', folder="c:/web2py/applications/crm/ > > models",auto_import=True) > > > result = db(db["customer"]).select() > > print(result) > > > On Jun 6, 2:05 pm, apple <simo...@gmail.com> wrote: > > > > I would like to be able to use the DAL to run standalone scripts to > > > query a database. I have managed to get this working by adding a "from > > > gluon import *" to mymodel and running the code below: > > > > import sys > > > sys.path.append("c:/web2py") > > > sys.path.append("c:/web2py/applications/crm/models") > > > from gluon import * > > > from mymodel import * > > > result = db(db["customer"]).select() > > > print(result) > > > > However if there is a reference to auth then I need to also change > > > mymodel to include: > > > from gluon.tools import * > > > auth = Auth(globals(),db) > > > This fails because there is no request. Is there a way round this to > > > make web2py think it is running a server?