Just adding my two cents since Denes explained it already. db=DAL(...)
right now DAL is a function and it may return one of two database objects (SQLDB or GQLDB). In there future DAL will become a class and db will be an instance of the DAL class. This will not change the API. db() is the Set of all records of all tables db(query) is the Set of all records matching the query. db(query)(...) is the Set subset of the above Set. db(query)(...)(...) etc. db(query).select (*fields,left=...,orderby=...,groupby=...,limitby=...,cache=...) fetches the data from the Set. The query determines which records to fetch. The argument of select() determine how to fetch the data. In the near future we may eliminate the distinction between a Set and a Query and allow both db(query).select(...) query.select(...) Massimo On Dec 18, 6:57 am, Jake <[email protected]> wrote: > First, let me say that i'm 10 days into Python and Web2Py. I > apologize if this is so rudimentary as to appear stupid. > > So there is no DAL class. DAL is a function, exported from the > gluon.sql module, that returns a SQLDB object if not using GAE, so: > > db = DAL('foo') > > makes db an instance of SQLDB. > > Now, lets say you do a db().select(). There is no select() method in > the SQLDB class. After going crazy for a couple hours, i learned what > __call__ was, and realized that this allows you to use the select() > method of the Set class from an instance of SQLDB. > > The select() method of the Set class always returns an instance of the > Rows class, which operates like a list, so you always have to access > the return value of the .select() method with iteration or indexes, > even if return value is guaranteed to return one or no values (a > lookup on an id, lets say). > > My question: What information do you have to send as parameters of > the db() call, what information do you send as parameters of > the .select() method, and why? > > Thank you very much, and please correct me if i'm wrong about > something, which is very likely. > > Jake -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.

