Many of you have complained about the pain of having to deal with table
with strange names for example table names containing a ".".
There is a quick solution in trunk:
# assuming
db =DAL()
db.define_table('owner',Field('name'))
db.define_table('thing',Field('name'),Field('owner','reference owner'))
i=db.owner.insert(name='max')
db.thing.insert(name='Chair',owner=i)
# you can do
db =DAL(enable_migrations=False)
db.define_table('o',Field('name'),actual_name='owner')
db.define_table('t',Field('name'),Field('owner','reference o'),
actual_name='thing')
print db(db.t.owner==db.o.id).select()
print db(db.t).select(db.t.ALL,db.o.ALL,left=[db.o.on(db.t.owner==db.o.id)])
The key here is in the second part. You can do actual_name="thing" and db.t
will be the same as db.thing and actual_name can contain "." or it can be
an escaped name like actual_name="[domain].[thing]".
This only works in reading, not in writing the tables. It passes my test
but please help me test it. It should be easy to make it work in writing
too.
Massimo
--
---
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.