I am trying to define a custom type on a MySQL db and I get the error
below. My motivation is to store data in Bigint rather than Integer.
bigint = SQLCustomType(
type = 'integer',
native = 'bigint',
)
db.define_table('s1',
Field('target_id', bigint)
)
db.s1.insert(target_id=55142201924)
I presume that I don't need to specify an encoder or a decoder.
The table creation is fine, but subsequent insert statements fail.
Once the tables are created, I can replace bigint with 'integer' and
everything works smoothly.
But I'm wondering if I am missing something crucial in my db.py .
Traceback (most recent call last):
File "/home/www-data/web2py.1.99.2/gluon/restricted.py", line 194,
in restricted
exec ccode in environment
File "/home/www-data/web2py.1.99.2/applications/groupiedev/models/
db.py", line 84, in <module>
db.s1.insert(target_id=55142201924)
File "/home/www-data/web2py.1.99.2/gluon/dal.py", line 4976, in
insert
return self._db._adapter.insert(self,self._listify(fields))
File "/home/www-data/web2py.1.99.2/gluon/dal.py", line 880, in
insert
query = self._insert(table,fields)
File "/home/www-data/web2py.1.99.2/gluon/dal.py", line 876, in
_insert
values = ','.join(self.expand(v,f.type) for f,v in fields)
TypeError: sequence item 0: expected string, int found