If each define_* returned its 'self', you can build a 'fluent
interface':

http://en.wikipedia.org/wiki/Fluent_interface

dal = DAL()
posts = dal.define_namespace('shared', '_shared').define_database
('gaedb', 'google').define_table('posts')

posts._tablename -> '_shared__posts'

Robin


On Feb 7, 12:03 pm, Robin B <robi...@gmail.com> wrote:
> Namespaces can also be generalized by unifying under the DAL:
>
> dal = DAL()
> dal.define_namespace('app',request.application)
> dal.define_namespace('shared','_shared')
> dal.shared.define_database('gaedb','google')
> dal.app.define_database('gaedb','google')
> dal.shared.gaedb.define_table('posts',dal.Field('title'))
>
> db = dal.shared.gaedb
>
> db.posts._tablename -> '_shared__posts'
>
> Robin
>
> On Feb 7, 11:40 am, Robin B <robi...@gmail.com> wrote:
>
> > And what about this:
>
> > dal = DAL()
> > dal.define_database('fsdb','filesystem')
> > dal.define_database('memdb','memcache')
> > dal.define_database('ramdb','dict')
>
> > cache.mem = CacheClient(db=dal.memdb)
> > cache.ram = CacheClient(db=dal.ramdb)
> > cache.disk = CacheClient(db=dal.fsdb)
>
> > @cache(request.env.path_info,time_expire=5,cache_model=cache.mem)
> > def cache_controller_in_ram():
> >     import time
> >     t=time.ctime()
> >     return dict(time=t,link=A('click me',_href=URL(r=request)))
>
> > Robin
>
> > On Feb 7, 11:25 am, Robin B <robi...@gmail.com> wrote:
>
> > > I am implementing the joins on GAE, and I realized that you should be
> > > able to perform joins between DAL databases whether it is the same
> > > driver or not.
>
> > > fsdb = FSDB(...,name='fsdb')
> > > gaedb = GAEDB(...,name='gaedb')
>
> > > rows = ((gaedb.users.name=='bob')&
> > > (gaedb.users.id==fsdb.users.id)).select(fsdb.users.data)
>
> > > rows[0].fsdb.users.data
>
> > > This should would work for FSDB, DICTDB, and also any API  that can be
> > > abstracted as a DAL (eg. MEMDB, ...).
>
> > > Robin
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to