Afternoon Guys,

 

I have a suspicion that I'm leaving MySQL database connections open when I
shouldn't be and I'm trying to understand how they are managed by
SQLAlchemy.

 

I currently create an engine instance and bind my session maker too it like
this:

 

            # Create the engine to the database.

            engine = create_engine(connection_string, echo=False)

 

            # Connect the session.

            Session = sessionmaker(bind=engine)

 

I then create sessions around my application by using:

 

            # Create a new session.

            session = Session()

 

and once finished with it closing the session like this:

 

            # Close the session. 

            session.close()

 

When are new connections established to the database when using this method?
And when are they closed again? The only reason I ask is that I've seen a
few errors recently on high load instance of my application which struggle
to connect to the database, I'm also seeing a few table corruptions and I
think they're all related issues from me perhaps creating too many
connections.

 

Thanks for any information you can share chaps,

 

Heston


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
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