📅  最后修改于: 2022-03-11 14:58:54.507000             🧑  作者: Mango
from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import scoped_session, sessionmaker
engine = create_engine('postgresql://{username}:{password}@{host}:{port}/{db_name}'.format(
username='postgres', password='postgres', host='127.0.0.1', port='5432', db_name='nkmemo'
))
db_session = scoped_session(sessionmaker(autocommit=False, autoflush=False, bind=engine))