123456789101112 |
- from sqlalchemy import create_engine
- from sqlalchemy.orm import sessionmaker
- import pymysql
- pymysql.install_as_MySQLdb()
- user = "choozmo"
- password = "pAssw0rd"
- host = "db.ptt.cx:3306"
- db_name = "test"
- engine = create_engine(f'mysql://{user}:{password}@{host}/{db_name}', pool_pre_ping=True)
- SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)
|