better way?

Pet petshmidt at googlemail.com
Tue Aug 11 15:40:22 EDT 2009


On 11 Aug., 21:23, "Rami Chowdhury" <rami.chowdh... at gmail.com> wrote:
> IIRC Postgres has had ON DUPLICATE KEY UPDATE functionality longer than  
> MySQL...
>

Ok, I've completely failed here :)

Thanks, man

>
>
>
>
> On Tue, 11 Aug 2009 11:45:50 -0700, Pet <petshm... at googlemail.com> wrote:
> > On 11 Aug., 20:39, Kushal Kumaran <kushal.kumaran+pyt... at gmail.com>
> > wrote:
> >> On Tue, Aug 11, 2009 at 10:03 PM, someone<petshm... 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
>
> > Oh, forgotten to mention. It's PostGres
>
> --
> Rami Chowdhury
> "Never attribute to malice that which can be attributed to stupidity" --  
> Hanlon's Razor
> 408-597-7068 (US) / 07875-841-046 (UK) / 0189-245544 (BD)




More information about the Python-list mailing list