Created
August 23, 2020 10:33
-
-
Save aliwo/e15546df1ad9ab3cd89ac19ba456f0cd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from flask import Flask | |
| from sqlalchemy import create_engine | |
| from sqlalchemy.orm import sessionmaker | |
| import time | |
| app = Flask(__name__) | |
| engine = create_engine('mysql+pymysql://root:22380476@localhost/pool?charset=UTF8MB4', pool_recycle=300) | |
| SessionMaker = sessionmaker(bind=engine) | |
| engine.execute('SELECT NOW();') | |
| @app.route('/') | |
| def index(): | |
| session = SessionMaker() | |
| print(engine.pool.status()) | |
| time.sleep(0.3) | |
| return 'Hello World' | |
| if __name__ == '__main__': | |
| app.run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment