Hi @all,
there are some issues opened since a long time to support "quoting" in
DAL.
For the ones in need of:
- accessing legacy tables with some funny names
- use reserved keywords for table and field names
- don't reveal real table names and general schema of the backend (for the
ones super-concerned about security)
- just have models that reflect a model and tables reflect tables (i.e. how
uncool is prefixing evey table with t_ and every field with f_ in your
code, given that in python is ugly while the backend stays more organized),
i.e. being able to do
*db.persons.name == 'a'* and let it transparently map to
*public.t_webapp_registered_persons.f_full_name
= "a"*
should **love** this feature.
As always, it's *highly experimental* but it's there to stay.
Purpose of the "greatest patch of them all" is to cleanly separate model
from underlying backend structure, meaning that you can have a *
db.table.field* that maps "transparently" to *whatever$the
heck.isthiscorrect,you're.insane *in any "raw" interaction with the db
itself.
This is achieved passing the RAW ALREADY QUOTED tablename (or fieldname)
string to the table definition.
Code example
db.define_table('easy_name',
Field('name', rname='*"this is the field name"*'),
rname='*"this is the easy_name table"*')
ATM it's tested with Mysql, PostgreSQL, SQLite, MSSQL.
*required for @all*: test your application code with trunk
*nice to have for @all interested*: run tests on your backend as it's
described here
http://www.web2pyslices.com/slice/show/1691/help-developers-adding-tests-to-web2py
and report back (here or in googlecode's issues) what doesn't work.
*nice to have for @Really-messy-legacy-table-model-that-doesn't-work : *bonus
karma points if you add a unittest to show what is failing, so it won't
happen again in future releases
*Triple bonus karma points* if you make a Pull Request in github to
actually fix the bug ^__^
Happy testing.
--
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/groups/opt_out.