i'm looking at moving some raw sql in twisted to SqlAlchemy and have a
question.
I have a multi-threaded twisted daemon that tends to generate a lot of race
conditions on a few tables that are frequently hit.
I get integrity errors from something like this :
domain = """SELECT * FROM domains WHERE ....""
if not domain :
domain = """INSERT INTO domain VALUES ....
the fix was :
domain = """SELECT * FROM domains WHERE ...."""
if not domain :
try:
savepoint = db.savepoint()
"""INSERT INTO domain VALUES ...."""
except psycopg2.IntegrityError :
savepoint,release()
domain = """SELECT * FROM domains WHERE ....""
is there a way to catch an integrity error like this with SqlAlchemy ?
i'm trying to get away from directly using psycopg2, it's getting too
annoying to maintain raw sql.
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/groups/opt_out.