Contents Menu Expand Light mode Dark mode Auto light/dark, in light mode Auto light/dark, in dark mode Skip to content
SQLAlchemy 2.1 Documentation
SQLAlchemy 2.1 Documentation
  • 概述
  • SQLAlchemy 统一教程
    • 建立连接 - Engine
    • 使用事务和DBAPI
    • 使用数据库元数据
    • 处理数据
      • 使用 INSERT 语句
      • 使用 SELECT 语句
      • 使用 UPDATE 和 DELETE 语句
    • 使用 ORM 进行数据操作
    • 使用 ORM 相关对象
    • 进一步阅读
  • SQLAlchemy ORM
    • ORM 快速入门
    • ORM 映射类配置
      • ORM 映射类概述
      • 使用声明式映射类
        • 声明式映射风格
        • 声明式的表配置
        • 使用声明式映射器配置
        • 使用 Mixins 组合映射层次结构
      • 与dataclass和attrs的集成
      • SQL 表达式作为映射属性
      • 更改Attribute的行为
      • 复合列类型
      • 映射类继承层次结构
      • 非传统映射
      • 配置版本计数器
      • 类映射 API
      • 映射 SQL 表达式
        • 映射表格列
    • 关系配置
      • 基本关系模式
      • 邻接表关系
      • 配置关系连接方式
      • 使用大型集合
      • 集合自定义和 API 详细信息
      • 特殊关系的持久化模式
      • 使用旧版“backref”关系参数
      • 关系 API
    • ORM 查询指南
      • 为 ORM 映射类编写 SELECT 语句
      • 为继承映射编写 SELECT 语句
      • 启用 ORM 的 INSERT、UPDATE 和 DELETE 语句
      • 列加载选项
      • 关系加载技术
      • 用于查询的 ORM API 功能
      • 旧式查询 API
    • 使用会话
      • 会话基础知识
      • 状态管理
      • 级联
      • 事务和连接管理
      • 其他的持久化技术
      • 上下文/线程本地会话
      • 使用事件跟踪查询、对象和会话更改
      • 会话 API
    • 事件和内部
      • ORM 事件
      • ORM 内部
      • ORM 异常
    • ORM 扩展
      • 异步 I/O (asyncio)
      • 关联代理
      • 自动映射
      • 烘焙查询
      • 声明式扩展
      • 突变追踪
      • 排序列表
      • 水平分片
      • 混合属性
      • Indexable
      • 替代类检测
    • 核心和 ORM 示例
  • SQLAlchemy Core
    • SQL 语句和表达式 API
      • 列元素和表达式
      • 操作符参考
      • SELECT 和相关构造
      • 插入,更新,删除
      • SQL 和 范型函数
      • 自定义 SQL 构造和编译扩展
      • 表达式序列化器扩展
      • SQL 表达式语言基础构造
      • 访问者和遍历实用程序
    • Schema 定义语言
      • 使用元数据描述数据库
      • 反射数据库对象
      • 列 INSERT/UPDATE 默认值
      • 定义约束和索引
      • 自定义 DDL
    • SQL 数据类型对象
      • 类型层次结构
      • 自定义类型
      • 基本类型 API
    • Engine和Connection的使用
      • Engine 配置
      • 使用Engines和Connection
      • 连接池
      • Core 事件
    • Core API 基础
      • 事件
      • 运行时审查 API
      • Core 异常
      • Core 内部
  • Dialects
    • PostgreSQL
    • MySQL 和 MariaDB
    • SQLite
    • Oracle
    • Microsoft SQL Server
  • 常见问题
    • 安装
    • 连接 / 引擎
    • 元数据 / Schema
    • SQL 表达式
    • ORM 配置
    • 性能
    • 会话 / 查询
    • 第三方包集成问题
  • 错误消息
  • 变更和迁移
    • SQLAlchemy 2.1 有什么新功能?
    • 2.1 Changelog
    • 2.0 Changelog
    • 1.4 Changelog
    • 1.3 Changelog
    • 1.2 Changelog
    • 1.1 Changelog
    • 1.0 Changelog
    • 0.9 Changelog
    • 0.8 Changelog
    • 0.7 Changelog
    • 0.6 Changelog
    • 0.5 Changelog
    • 0.4 Changelog
    • 0.3 Changelog
    • 0.2 Changelog
    • 0.1 Changelog
    • SQLAlchemy 2.0 - Major Migration Guide
    • What’s New in SQLAlchemy 2.0?
    • What’s New in SQLAlchemy 1.4?
    • What’s New in SQLAlchemy 1.3?
    • What’s New in SQLAlchemy 1.2?
    • What’s New in SQLAlchemy 1.1?
    • What’s New in SQLAlchemy 1.0?
    • What’s New in SQLAlchemy 0.9?
    • What’s New in SQLAlchemy 0.8?
    • What’s New in SQLAlchemy 0.7?
    • What’s New in SQLAlchemy 0.6?
    • What’s new in SQLAlchemy 0.5?
    • What’s new in SQLAlchemy 0.4?
Back to top

Appendix: Copyright¶

This is the MIT license: https://www.opensource.org/licenses/mit-license.php

Copyright (c) 2005-2025 Michael Bayer and contributors. SQLAlchemy is a trademark of Michael Bayer.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Copyright © 2007-2025, the SQLAlchemy authors and contributors
Made with Sphinx and @pradyunsg's Furo
Last updated on 04/15/2025 02:01:24