On Fri, Jan 10, 2014 at 3:50 PM, Sylvester Steele
<sylvesterste...@gmail.com> wrote:
> Hi,
> Currently I am using the sqlalchemy engine to execute string queries only. I
> do plan on using sqlalchemy more extensively (including ORM) in the near
> future.
> I need to add retry logic on every query, in case of some database failures
> (less than ideal, but the server is a bit flaky).
>
> Questions:
> 1. Would subclassing the Engine and overriding the execute function achieve
> this?

Let me first point out, that you cannot consider all queries equal,
and retry-able.

First problem you'll face, is secondary effects. Update and inserts
obviously, but secondary effects hidden in select queries could also
be an issue (say, triggers or something else that has a secondary
effect).

Second problem you'll face are transactions. When a failure occurs,
you usually have no choice to retry a single query, you have to retry
the whole transaction.

So doing it at the Engine level may prove a bad choice with the above in mind.

-- 
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 sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to