Usually you create a "script" file in /models/db.py then you define your
tables there, so when starting in shell mode you pass -M

python web2py.py -S yourapp -M

-M run the models/* files and defines your table as "object" for you to
access.

Every framework works in this way.

Optionally, you can use db.executesql("PUT YOUR SQL HERE") and do it by
your own...

On Sat, Feb 9, 2013 at 4:13 AM, Alec Taylor <[email protected]> wrote:

> Hold up; you mean to tell me I need to redefine the schema each time a new
> db (DAL object) needs to access it?
>
> That sounds silly.
>
> Isn't there a way around this?
>
>
> On Saturday, February 9, 2013 4:40:28 PM UTC+11, Vasile Ermicioi wrote:
>>
>> let say you have table1 and table2 in database,
>>
>> you shoud define your tables
>>
>> db.define_table('table1',
>> ..)
>>
>> and only after that you will have access to db.table1
>>
>> you can;t access db.table2 if it is not defined even if it exists in the
>> database
>>
>  --
>
> ---
> 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/groups/opt_out.
>
>
>

-- 

--- 
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/groups/opt_out.


Reply via email to