I tried:
Field('`group`', ...),
AND
Field("'group'",...),
Resulting in a ticket:
SyntaxError: only [0-9a-zA-Z_] allowed in table and field names,
received `group`
On Wed, Jun 20, 2012 at 10:29 PM, Cliff Kachinske <[email protected]> wrote:
> It occurs to me you might try this
>
> Field("'group'"....),
>
>
>
> On Wednesday, June 20, 2012 2:03:48 PM UTC-4, acidjunk wrote:
>>
>> Hi All,
>>
>> I use web2py to create a admin interface for an older project with an
>> existing database in MySQL.
>> So I extracted the DAL info with an script.
>>
>> --extracted from current mysql db --
>> user_db.define_table('users',
>> Field('user_id', 'id'),
>> Field('login_name', 'string'),
>> Field('title', 'string'),
>> Field('first_name', 'string'),
>> Field('last_name', 'string'),
>> Field('birthdate', 'datetime'),
>> Field('group', user_db.group_names,
>> requires=IS_IN_DB(user_db,'group_names.group_id','%(group_name)s')),
>> format='%(first_name)s %(last_name)s')
>> --
>> When I try to insert or update stuff web2py serves me a ticket.
>> Viewing the record is no problem. It even shows the dropdown with
>> groupnames from the linked_table.
>>
>> In the documentation on
>>
>> http://www.web2py.com/examples/static/epydoc/web2py.gluon.reserved_sql_keywords-pysrc.html
>> it says that "GROUP" is a keyword.
>> Is there a way to force the DAL to quote the fieldNames in its insert
>> and update query's? With our previous framework we didn't experience
>> any problems with a field "group" in a mysql table.
>> It would be cool if there is a way to loosen the restrictions on
>> reserved keywords on a per app basis.
>>
>> Kind Regards
>>
>> Rene Dohmen
--