better way?

Kushal Kumaran kushal.kumaran+python at gmail.com
Tue Aug 11 20:39:30 CEST 2009


On Tue, Aug 11, 2009 at 10:03 PM, someone<petshmidt at googlemail.com> wrote:
> Hello,
>
> I'd like to make insert into db if record not exist otherwise update.
> to save typing list of columns in both statements I do following
>
> <snip>
>
>
> is there better or more readable way to do it?
>

Well, mysql, in particular, offers an "on duplicate key update" clause
that you can take a look at.  Don't know about about other databases.

-- 
kushal



More information about the Python-list mailing list