'just wondering is the default id on table that is generated by dal can be
replace from integer auto increment into uuid type ?' - I do it everyday!
On Saturday, January 28, 2017 at 12:50:24 AM UTC+3, 黄祥 wrote:
>
> it just created the new field on table name uuid and assign it as a
> primary key, so the result on table field is :
> id, uuid, name
> so that's what i do right now
> e.g.
> *models/db.py*
> db.define_table('test',
> Field('uuid'),
> Field('name') )
>
> *controllers/default.py*
> def import_csv():
> form = SQLFORM.factory(Field('csvfile', 'upload', uploadfield = False)
> )
> form.process()
> if form.accepted:
> csvtxt = request.vars.csvfile.file.read()
> csvtxt = csvtxt.replace('Id,Name', 'uuid,name')
> db.test.import_from_csv_file(StringIO(csvtxt) ) #Import CSV file
> in cm1_for_update table
> return dict(form = form)
>
> just wondering is the default id on table that is generated by dal can be
> replace from integer auto increment into uuid type ?
>
> thanks and best regards,
> stifan
>
>
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.