updating before insert

"Eric S. Johansson" <[email protected]>
Newsgroups gmane.comp.python.db.pysqlite.user
Message-ID <[email protected]>
I've tried a couple different ways of doing this but I'm screwing
something up.  I know this is part SQL but it's also part Python and how
they interfere... I mean interacts with each other.

What's the right way to update a few fields in a record if the record
exists otherwise, create the record?

Related is:

What's the right way to test for a record (including a predicate against
some of the fields (specifically timestamp calculations)) and if the
record doesn't exist, add it.

In both cases, handle the implicit race conditions between testing and
creating/setting.

(I'm coming to feel like that Monty Python character, sitting in a local
restaurant screeching "but I don't like SQL")

---eric
(related to those bloody Vikings)


-- 
Speech-recognition in use.  It makes mistakes, I correct some.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.