> throw consistent errors at consistent points of execution.  if you
> think your database was stopped and is now re-started, you can call
> invalidate() on an individual connection and then close() it for it
> to be replaced in the pool, or more likely you can call dispose() on
> your engine and it will load up a new connection pool upon the next
> usage.

So where should I put this logic. In the past I would have created
wrappers around the db.execute command and in that I would have
checked if there were any errors. If there were any errors I would try
to see if there were any connection related errors and then try to
reconect and then resubmit the sql statement.

However, I'm a little confused on how I would do this with sql
alchemy. More sepcifically with all the introspection that goes on.
For instance for one of my connections I do the following:

metadata = BoundMetaData(mysqlDb.mysql_db)
view1= sqlalchemy.Table('view1', db.metadata, autoload=True)

So would I do the following:

connect_to_db():
       [recreate the mysqlDb engine]
       metadata = BoundMetaData(mysqlDb.mysql_db)
       view1= sqlalchemy.Table('view1', db.metadata, autoload=True)

execute_statement(statement):
   try:
       statement.execute()
   except: [check for connection related errors]
connect_to_db
       statement.execute()

Or,

I'm assuming the above is not enough, because all the other views
would be invalidated as well.


--~--~---------~--~----~------------~-------~--~----~
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