Sorry about that, my code is in flux right now as I'm working through it.

Here are two methods that are working:

db[table_name].insert(**r)

db(db[table_name]._id == current_id).update(**r)


These methods aren't working:

db[table_name].update_or_insert(**r)

db[table_name].update_or_insert(db[table_name]._id == current_id,**r)   


Do I have that syntax right to pass a dictionary to update_or_insert?

I'm using a PostgreSQL backend, but the docs say only DB2, MS-SQL, Ingres 
and Informix databases support keyed tables.

Thanks again!




On Friday, July 7, 2017 at 3:46:30 PM UTC-7, Anthony wrote:
>
> Can't help if we don't see some code.
>
> On Friday, July 7, 2017 at 5:23:55 PM UTC-4, ad...@swcacloud.com 
> <javascript:> wrote:
>>
>> Thanks for the quick reply.  I'm not having any luck with 
>> update_or_insert, but insert and update work fine individually.  I'm using 
>> keyed tables, so that may be why.
>>
>>
>>
>> On Friday, July 7, 2017 at 11:40:55 AM UTC-7, Anthony wrote:
>>>
>>> On Friday, July 7, 2017 at 2:27:52 PM UTC-4, ad...@swcacloud.com wrote:
>>>>
>>>>
>>>> We can insert and update from a dictionary, but its not possible to do 
>>>> the same with "update_or_insert"?  Is there a simple way to achieve that, 
>>>> or would it require changes to that dal function?
>>>>
>>>>
>>>> http://www.web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Inserting-and-updating-from-a-dictionary
>>>>
>>>
>>> The above is a feature of the Python language itself -- you can use that 
>>> syntax to pass arguments to any function or method in Python, including 
>>> .update_or_insert(). The book provides examples for .insert() and .update() 
>>> just as a hint for those that might not be aware of this possibility, but a 
>>> lack of such examples for other methods and functions should not be taken 
>>> to imply that it is not possible.
>>>
>>> Anthony
>>>
>>

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to