Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

define_table fails with IS_IN_SET() -- barfs an exception

22 views
Skip to first unread message

Dave S

unread,
Oct 17, 2024, 7:10:03 PM10/17/24
to web2py-users
Trying to define a table with IS_IN_SET() on a string field,  we get the exception
<class 'sqlite3.OperationalError'> near "<": syntax error

sql.log shows why:
CREATE TABLE "badqpic"(
    "id" INTEGER PRIMARY KEY AUTOINCREMENT,
    "isrl" CHAR(512),
    "isrl_short" CHAR(512),
    "tmpname" CHAR(512),
    "tmppext" CHAR(512),
    "tags" CHAR(<pydal.validators.IS_IN_SET object at 0x000001290744CD30>),
    "originalid" INTEGER,
    "postdate" DATE
);

and the exception traceback shows
[...]
  • File C:\Users\Dave\web2py_src\web2py_src-2.22.5\web2py\gluon\packages\dal\pydal\base.py in define_table at line 679 

  • File C:\Users\Dave\web2py_src\web2py_src-2.22.5\web2py\gluon\packages\dal\pydal\base.py in lazy_define_table at line 716 

  • File C:\Users\Dave\web2py_src\web2py_src-2.22.5\web2py\gluon\packages\dal\pydal\adapters\base.py in create_table at line 943 

  • File C:\Users\Dave\web2py_src\web2py_src-2.22.5\web2py\gluon\packages\dal\pydal\migrator.py in create_table at line 337 

  • File C:\Users\Dave\web2py_src\web2py_src-2.22.5\web2py\gluon\packages\dal\pydal\adapters\base.py in create_sequence_and_triggers at line 1027

  • File C:\Users\Dave\web2py_src\web2py_src-2.22.5\web2py\gluon\packages\dal\pydal\adapters\__init__.py in wrap at line 69 

  • File C:\Users\Dave\web2py_src\web2py_src-2.22.5\web2py\gluon\packages\dal\pydal\adapters\base.py in execute at line 468 

    (self=<pydal.adapters.sqlite.SQLite object>, *args=('CREATE TABLE "babbleqpic"(\n "id" INTEGER PRIMARY...\n "originalid" INTEGER,\n "postdate" DATE\n);',), **kwargs={})

  • Function argument list

  • (self=<pydal.adapters.sqlite.SQLite object>, *args=('CREATE TABLE "babbleqpic"(\n "id" INTEGER PRIMARY...\n "originalid" INTEGER,\n "postdate" DATE\n);',), **kwargs={})


web2py™
Version 2.22.5-stable+timestamp.2022.06.04.18.13.51
Python
Python 3.10.7: C:\Users\Dave\AppData\Local\Programs\Python\Python310\python.exe (prefix: C:\Users\Dave\AppData\Local\Programs\Python\Python310)



Dave S

unread,
Oct 17, 2024, 10:56:35 PM10/17/24
to web2py-users
Never mind ... I forgot the "requires ="

/dps
Reply all
Reply to author
Forward
0 new messages