title: How to completely remove database connection in sqlalchemy? Giving max_user_limit on python anywhere
body: <p>I am hosting a flask application on Pythonanywhere. Where I have to make few queries from the database. While using MySQLdb I am able to close all the connection to database and don't get any error. But while using sqlalchemy some how connections to the database do not get closed.</p>
  
  <p>This is my connection manager class which has a method defined to close the database connection.</p>
  
  <pre><code>class ConnectionManager:
      def __init__(self):
          self.base = declarative_base()
  
      def get_db_session(self):
          self.engine = create_engine(get_db_path())
          self.base.metadata.bind = self.engine
          self.session_maker = sessionmaker(bind = self.engine)
          self.session = self.session_maker()
          return self.session
  
      def persist_in_db(self,record):
          session = self.get_db_session()
          session.add(record)
          session.commit()
          session.close()
  
      def close_session(self):
          self.session.close()
          self.session_maker.close_all()
          del self.session
          del self.session_maker
          del self.engine
         #self.engine.dispose()
  </code></pre>
  
  <p>Before returning the response form the app I call close_session method.
  So my question basically is where I am conceptually getting wrong and how can I completely remove database connection.</p>