无法弄清楚 Web2py Ticket 错误很奇怪
Can't figure out Web2py Ticket error its odd
我是 Web2py 的新手,无法理解票证抛出的错误。有人可以解释错误以及为什么会发生吗?
Ticket ID
127.0.0.1.2016-05-28.15-45-10.493c5f3c-e5f2-4034-8e82-69637b1fcc35
<type 'exceptions.SyntaxError'> invalid table/column name "size" is a "ALL" reserved SQL/NOSQL keyword
Version
web2py™ Version 2.12.1-stable+timestamp.2015.08.07.07.22.06
Traceback (most recent call last):
File "C:\Users\sharankumar\Desktop\New\gluon\restricted.py", line 227, in restricted
exec ccode in environment
File "C:/Users/sharankumar/Desktop/New/applications/MyLogin/models/db.py", line 232, in <module>
format='%(name)s')
File "C:\Users\sharankumar\Desktop\New\gluon\packages\dal\pydal\base.py", line 817, in define_table
table = self.lazy_define_table(tablename,*fields,**args)
File "C:\Users\sharankumar\Desktop\New\gluon\packages\dal\pydal\base.py", line 834, in lazy_define_table
table = table_class(self, tablename, *fields, **args)
File "C:\Users\sharankumar\Desktop\New\gluon\packages\dal\pydal\objects.py", line 351, in __init__
check_reserved(field_name)
File "C:\Users\sharankumar\Desktop\New\gluon\packages\dal\pydal\base.py", line 519, in check_reserved_keyword
'invalid table/column name "%s" is a "%s" reserved SQL/NOSQL keyword' % (name, backend.upper()))
SyntaxError: invalid table/column name "size" is a "ALL" reserved SQL/NOSQL keyword
在 db.define_table()
中,您似乎试图创建一个名为 "size" 的字段,这是不允许的,因为它是 SQL 保留字。您应该更改字段名称或使用 "rname" 参数为要使用的数据库指定不同的名称:
Field('size', rname='object_size', ...)
通过上述,您可以在所有 Python 代码中使用名称 "size",但数据库实际上会创建一个名称为 "object_size".[=12 的字段=]
我是 Web2py 的新手,无法理解票证抛出的错误。有人可以解释错误以及为什么会发生吗?
Ticket ID
127.0.0.1.2016-05-28.15-45-10.493c5f3c-e5f2-4034-8e82-69637b1fcc35
<type 'exceptions.SyntaxError'> invalid table/column name "size" is a "ALL" reserved SQL/NOSQL keyword
Version
web2py™ Version 2.12.1-stable+timestamp.2015.08.07.07.22.06
Traceback (most recent call last):
File "C:\Users\sharankumar\Desktop\New\gluon\restricted.py", line 227, in restricted
exec ccode in environment
File "C:/Users/sharankumar/Desktop/New/applications/MyLogin/models/db.py", line 232, in <module>
format='%(name)s')
File "C:\Users\sharankumar\Desktop\New\gluon\packages\dal\pydal\base.py", line 817, in define_table
table = self.lazy_define_table(tablename,*fields,**args)
File "C:\Users\sharankumar\Desktop\New\gluon\packages\dal\pydal\base.py", line 834, in lazy_define_table
table = table_class(self, tablename, *fields, **args)
File "C:\Users\sharankumar\Desktop\New\gluon\packages\dal\pydal\objects.py", line 351, in __init__
check_reserved(field_name)
File "C:\Users\sharankumar\Desktop\New\gluon\packages\dal\pydal\base.py", line 519, in check_reserved_keyword
'invalid table/column name "%s" is a "%s" reserved SQL/NOSQL keyword' % (name, backend.upper()))
SyntaxError: invalid table/column name "size" is a "ALL" reserved SQL/NOSQL keyword
在 db.define_table()
中,您似乎试图创建一个名为 "size" 的字段,这是不允许的,因为它是 SQL 保留字。您应该更改字段名称或使用 "rname" 参数为要使用的数据库指定不同的名称:
Field('size', rname='object_size', ...)
通过上述,您可以在所有 Python 代码中使用名称 "size",但数据库实际上会创建一个名称为 "object_size".[=12 的字段=]