You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
14 lines
422 B
14 lines
422 B
from sqlalchemy import create_engine
|
|
from sqlalchemy.orm import sessionmaker, declarative_base
|
|
|
|
# 数据库连接字符串
|
|
SQLALCHEMY_DATABASE_URL = "mysql+pymysql://root:mypassword12@127.0.0.1:3306/lianai"
|
|
|
|
# 创建数据库引擎
|
|
engine = create_engine(SQLALCHEMY_DATABASE_URL)
|
|
|
|
# 创建会话本地类
|
|
SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)
|
|
|
|
# 声明基类
|
|
Base = declarative_base() |