from sqlalchemy import create_engine from sqlmodel import Session, select from app.models.report_urls import ReportUrlModel dsn = f"mysql+pymysql://root:123456@localhost:3306/baidu_reporter" engine = create_engine(dsn, echo=True) with Session(engine) as session: stmt = select(ReportUrlModel).where(ReportUrlModel.surl == "4444") result = session.exec(stmt).first() print(result) if not result: example = ReportUrlModel( domain_id=1, domain="111", surl="4444", ) session.add(example) session.commit()