import sys; sys.path.append('/path/to/web2py')

On May 25, 8:53 pm, mattgorecki <[email protected]> wrote:
> In order to do
>
> from gluon import DAL
>
> from an external program, I would need to add gluon to my Python path,
> correct?  What directory does gluon live in?
>
> Matt
>
> On May 25, 7:43 pm, Massimo Di Pierro <[email protected]>
> wrote:
>
>
>
>
>
>
>
> > now you can do, from ANY python program
>
> > from gluon import DAL
> > db=DAL('sqlite://storage.sqlite',folder='applications/app/
> > databases',auto_import=True)
> > print db.tables
>
> > auto_import = True will rebuild all tables WITHOUT executing the
> > modules. Tables will have the right names, field names and field types
> > but will not have the right attributes (default, widget, readable,
> > writable, etc...) because they make no sense without an HTTP request.
> > This is only thought to allow a script to perform inserts and selects.
>
> > CAVEAT: this requires you run the app at least once using the new
> > trunk code since requires the new metadata format. By running the app
> > the *.table files are automatically converted to the new format.
>
> > Give it a try. Let me know if you have ideas for improvements.
>
> > Massimo
>
> > P.S. More stuff coming soon. ;-)

Reply via email to