I'm evaluating SA to see if it's right for my needs, so this is sort
of a general question.  Feel free to answer my questions by pointing
me to the right section of the docs -- I don't mind being told to
RTFM.  But I've done a little RTFM'ing, at least in the introductory
level docs, and I haven't seen too much information about error
handling.  I'm curious how SA handles this, especially transient
errors where a retry is the right thing to do.  For example, in
several of my current sqlite apps (using bare DB-API), I get
occasional locking errors ("Database is locked"), which happens
sometimes with sqlite when there are concurrent processes accessing
the DB.  The right thing to do is retry, but it's a real pain to write
*every* database operation with retry logic.  Does SA handle retries
in cases like this automatically?  (Admittedly, I think that more
recent versions of pysqlite handle locked DBs better than the somewhat
stale version I'm currently using, but I'm after the general principle
rather than trying to solve that particular problem.)

Aside from that, how in general does SA handle errors returned by the
underlying DB?  Does it automatically do a rollback and/or reconnect
if necessary?  If you're using the ORM layer is it able to still
figure out what objects/fields are dirty if an error was encountered
while trying to flush changes to disk?  Is the programmer responsible
for differentiating between errors that indicate that a reconnect is
necessary and errors where the connection can continue to be used?
For example, if the DB throws a "connection lost" type of error, that
connection (and likely all the rest in the pool) must be re-opened,
and I want my DB layer to notice this and act appropriately --
including not losing track of what changes still need to be committed
at the ORM layer.  Ideally, if the reconnect is successful, I never
want to know anything went wrong -- I just want SA to retry a
reasonable number of times and only throw an exception if it continues
to fail.  But if the DB just threw a primary key constraint violation,
the connection is still healthy, and I want my DB layer to just let me
know so I can handle the situation appropriately (such as switching
the insert to an update, or deleting the existing record, or passing
the error on up to the user).

TIA for any info,

-- 
Randall

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to