db_handle.MYTAB.insert(**wFields)

Anthony

On Monday, March 20, 2017 at 9:42:38 AM UTC-4, dicolla wrote:
>
> I'd like to convert this static INSERT command:
>
>     db_handle.MYTAB.insert(date='1212121', time='999999' )
>
> in a dynamic command like this:
>
>     wFields=[]
>     wFields.append( {'date':'1212121'} )
>     wFields.append( {'time':'999999'} )
>     db_handle.MYTAB.insert(wFields)
>
> but I got an error:
>
>     Error processing ..., insert() takes exactly 1 argument (2 given)
>
> If I use: 
>
>   db_handle.MYTAB.insert(*wFields)
>
> I got the error:
>
>     Error processing ..., insert() takes exactly 1 argument (3 given)
>
>
> So, how can I build dynamically the set of parameters when calling the 
> function INSERT of WEB2PY ?
>
>
> I use this way to create a TABLE with dynamic FIELDS and this works with 
> no problem:
>
>        wFields = []
>
>         for key, pos,  in template_fields:
>             wName = str(key)
>             wFields.append(Field( wName ))
>
>         db_handle.define_table('IISLOG', *wFields )
>
>
>

-- 
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.

Reply via email to