This is some rabbit hole,  looks like I need to do the following for some 
odd reason.  

db = DAL('sqlite://TestDB.sqlite', migrate_enabled=False



On Wednesday, March 9, 2016 at 3:06:45 PM UTC-8, 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. 
>
> db.tables
> []
> db.define_table('person',
>
>  Field('fname', 'string'),
>  Field('lname', 'string'),
>  Field('building', 'string')
>  )
> <Table person (id,fname,lname,building)>
> rows = db(db.person.lname == 'Thorns').select()
> rows
> <Rows (2)>
> for e in rows:
>   print e
>
>
>  
> <Row {'building': 'A', 'lname': 'Thorns', 'fname': 'Billy', 'id': 1L}>
> <Row {'building': 'A', 'lname': 'Thorns', 'fname': 'Judy', 'id': 2L}>
>
>
>
> Thanks for the help. 
>
> On Wednesday, March 9, 2016 at 2:59:11 PM UTC-8, Niphlod wrote:
>>
>> DAL is a database abstraction layer. you need to define tables EVERY time 
>> you need to access them. 
>> define_table() accidentally creates table if migrations are turned on, 
>> but define_table() doesn't map to "create a table" .... it stands for 
>> "define an entity that is mapped to a table".
>>
>> tl;dr: if you kill the process and reinitiate the DAL connection, DAL 
>> doesn't do introspection on the tables present on the database. it'll 
>> interact only with tables which have been previously defined.
>>
>> see 
>> http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer 
>> for all the gory details....
>>
>>
>>>

-- 
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