db.define_table('easy_name',
Field('position', rname='"this_is_the_field_name"'),
rname='"this_is_the_easy_name_table"')
but it returns an error as follows:Traceback (most recent call last):
File "C:\w2p_5\gluon\restricted.py", line 220, in restricted
exec ccode in environment
File "C:/w2p_5/applications/test_1/models/db_1.py", line 11, in <module>
rname='"this_is_the_easy_name_table"')
File "C:\w2p_5\gluon\dal.py", line 8223, in define_table
table = self.lazy_define_table(tablename,*fields,**args)
File "C:\w2p_5\gluon\dal.py", line 8240, in lazy_define_table
table = table_class(self, tablename, *fields, **args)
File "C:\w2p_5\gluon\dal.py", line 8754, in __init__
check_reserved(field_name)
File "C:\w2p_5\gluon\dal.py", line 7931, in check_reserved_keyword
'invalid table/column name "%s" is a "%s" reserved SQL/NOSQL keyword' % (name, backend.upper()))
SyntaxError: invalid table/column name "position" is a "ALL" reserved SQL/NOSQL keyword
Running 2.9.5There there something I've overlooked? TIA
Yep, agree with that but to quote Niphlod "
- use reserved keywords for table and field names "
timestamp: 2014-07-21T15:57:35.749000
CREATE TABLE auth_cas(
id INTEGER PRIMARY KEY AUTOINCREMENT,
user_id INTEGER REFERENCES auth_user (id) ON DELETE CASCADE,
created_on TIMESTAMP,
service CHAR(512),
ticket CHAR(512),
renew CHAR(1)
);
success!
timestamp: 2014-07-21T15:59:39.060000
CREATE TABLE "this_is_the_easy_name_table"(
id INTEGER PRIMARY KEY AUTOINCREMENT,
"this_is_the_field_name" CHAR(512)
);
success!
(dp1
S'position1'
p2
(dp3
S'length'
p4
I512
sS'unique'
p5
I00
db = DAL(...., check_reserved=None)
db.define_table('easy',
Field('position', rname='"difficult_name_for_the_field"'),
rname='"difficult_name_for_table"')db(db.t_ABCD_Alpha_Blocking_Common_Dolls.ABCD_CreationDateForTicket > request.now).select(db.t_ABCD_Alpha_Blocking_Common_Dolls.ALL)tb = db.t_ABCD_Alpha_Blocking_Common_Dolls
db(tb.ABCD_CreationDateForTicket > request.now ).select(tb.ALL)
db.define_table('ABCD',
Field('CreateDate', rname='"ABCD_CreationDateForTicket"'),
rname='"t_ABCD_Alpha_Blocking_Common_Dolls"')db(db.ABCD.CreateDate > request.now).select(db.ABCD.ALL)--
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 web2py+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.