You can also use explicit quoting of entities at DAL level.  It works
transparently so you can use the same names in python and in the DB schema.

db = DAL('postgres://...', ...,ignore_field_case=False, entity_quoting=True)


db.define_table('table1', Field('column'), Field('COLUMN'))

print db(db.table1.COLUMN != db.table1.column).select()




2014-07-22 10:09 GMT+02:00 Niphlod <[email protected]>:

> if it's what I think, then
>
> db = DAL(...., check_reserved=None)
> db.define_table('easy',
>        Field('position', rname='"difficult_name_for_the_field"'),
> rname='"difficult_name_for_table"')
>
> should work (albeit, if it does, it shows "the bug" because if you're
> using rname, then you don't need to check for reserved keywords).
>
> The point of rname (in addition to give the possibility to use the proper
> quoting directly) is also to separate model from the underling structure.
>
> Usually I'm dealing with table names like
> t_ABCD_Alpha_Blocking_Common_Dolls and fields like
> ABCD_CreationDateForTicket (very enteprisey.... ^_^''') ... until rname my
> code was full of
>
> db(db.t_ABCD_Alpha_Blocking_Common_Dolls.ABCD_CreationDateForTicket >
> request.now).select(db.t_ABCD_Alpha_Blocking_Common_Dolls.ALL)
>
>
> that eventually turned up to be
>
> tb = db.t_ABCD_Alpha_Blocking_Common_Dolls
> db(tb.ABCD_CreationDateForTicket > request.now ).select(tb.ALL)
>
>
>
> but it was a vibe-killer.
>
> Now I can
>
> db.define_table('ABCD',
> Field('CreateDate', rname='"ABCD_CreationDateForTicket"'),
> rname='"t_ABCD_Alpha_Blocking_Common_Dolls"')
>
>
> and use
>
> db(db.ABCD.CreateDate > request.now).select(db.ABCD.ALL)
>
>
>
>
> On Tuesday, July 22, 2014 12:29:06 AM UTC+2, Simon Ashley wrote:
>
>> Thanks Niphlod, its the latter. A question just concerning rname/ quoting
>> 101.
>> Haven't used it before, and trying baby steps to see how it works.
>> (couldn't see it hitting the relevant sections of dal.py)
>> A simple working example would give me a push in the right direction.
>>
>> While Limedrop raises interesting points which I''ll explore, its not
>> where my headspace is currently at.
>>
>>  --
> 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.
>

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