• SQLAlchemy基本用法

    2021-11-07 浏览:42
    SQLAlchemy是Python中一个通过 ORM 操作数据库的框架 安装 pip3 install sqlalchemy 引入 from sqlalchemy import create_engine, or_ from sqlalchemy.ext.declarative import declarative_base from sqlalchemy import Column, Integer, String, DateTime from sqlalchemy.orm import sessionmaker 连接数据库 举例 sqlite3 Base = declarative_base() engine = create_engine('sqlite:///main.db', encoding="utf-8", echo... 展开全文