On Wednesday, March 9, 2016 at 6:06:45 PM UTC-5, Shayn Raney wrote:
>
> So I take it I need to redescribe the DB again using define_table()?  Ok, 
> it works!  So strange.  I'm use to web.py SQL actions. 
>

The DAL models let you do a lot more via Python than you can do with 
web.py, which is not far removed from just writing raw SQL. If you want, in 
web2py you can simply use db.executesql(...) to execute any SQL you want 
without defining any models. Also, you can do:

db = DAL('sqlite://TestDB.sqlite', auto_import=True)

and it will automatically create model definitions based on the migration 
metadata (the definitions will be missing some web2py-only attributes that 
don't relate to the database itself, such as validators, labels, etc.).

Finally, if you need to work in a shell with the database/models of a 
particular web2py app, rather than starting a standard Python shell, you 
should instead do:

python web2py.py -S myapp -M

You'll then get a shell with the entire web2py environment, including any 
objects defined in your models -- so you would have access to the db object 
with all of its models defined.

Anthony

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to