版本:1.1.0b2 |发布日期:2016年7月1日

SQLAlchemy 1.1文档

0.9 Changelog

0.9.11 ¶ T0>

没有发布日期

发动机¶ T0>

  • [engine] [bug] Fixed critical issue whereby the pool “checkout” event handler may be called against a stale connection without the “connect” event handler having been called, in the case where the pool attempted to reconnect after being invalidated and failed; the stale connection would remain present and would be used on a subsequent attempt. 这个问题在1.0.2之后的1.0系列中有更大的影响,因为它还向事件处理程序提供了一个空白的.info字典;在1.0.2之前,.info字典仍然是前一个。

    参考文献:#3497

预言¶ T0>

  • [oracle] [bug] [py3k] Fixed support for cx_Oracle version 5.2, which was tripping up SQLAlchemy’s version detection under Python 3 and inadvertently not using the correct unicode mode for Python 3. 这会导致绑定变量被错误地解释为NULL,并且行无声无息地返回。

    参考文献:#3491

0.9.10 ¶ T0>

发布日期:2015年7月22日

ORM ¶ T0>

  • [orm] [feature] 向由Query.column_descriptions返回的字典添加了一个新条目"entity"这是指由表达式引用的主要ORM映射类或别名类。"type"的现有条目相比,即使从列表达式中提取,它也将始终是映射实体,如果给定表达式是纯粹核心表达式,它将始终为None。另见#3403,它修复了此功能中的回归,该功能在0.9.10中未发布,但在1.0版本中发布。

    参考文献:#3320

  • [orm] [bug] Query doesn’t support joins, subselects, or special FROM clauses when using the Query.update() or Query.delete() methods; instead of silently ignoring these fields if methods like Query.join() or Query.select_from() has been called, a warning is emitted. 从1.0.0b5开始,这会引发错误。

    参考文献:#3349

  • [orm] [bug] Fixed bug where the state tracking within multiple, nested Session.begin_nested() operations would fail to propagate the “dirty” flag for an object that had been updated within the inner savepoint, such that if the enclosing savepoint were rolled back, the object would not be part of the state that was expired and therefore reverted to its database state.

    参考文献:#3352

发动机¶ T0>

  • [engine] [bug] Added the string value "none" to those accepted by the Pool.reset_on_return parameter as a synonym for None, so that string values can be used for all settings, allowing utilities like engine_from_config() to be usable without issue.

    参考文献:#3375

SQL ¶ T0>

  • [sql] [feature] 增加了对Insert.from_select()中存在的SELECT所使用的CTE的官方支持。这种行为意外地一直运行到0.9.9,当它由于作为#3248的一部分的不相关更改而不再起作用时。请注意,这是在SELECT之前的INSERT之后的WITH子句的呈现;在INSERT,UPDATE,DELETE顶层呈现的CTE的全部功能是针对以后版本的一项新功能。

    参考文献:#3418

  • [sql] [bug] Fixed issue where a MetaData object that used a naming convention would not properly work with pickle. 如果使用不带钩的MetaData对象来构建附加表格,则跳过该属性会导致不一致和失败。

    参考文献:#3362

的PostgreSQL ¶ T0>

  • [postgresql] [bug] 修复了长期存在的bug,其中psycopg2方言使用的Enum类型与非ascii值和native_enum=False将无法正确解码返回结果。这源于PG postgresql.ENUM类型曾经是没有“非本地”选项的独立类型。

    参考文献:#3354

MySQL的¶ T0>

  • [mysql] [bug] [pymysql] 修正了使用unicode参数使用“executemany”操作时对PyMySQL的Unicode支持。SQLAlchemy现在将语句以及绑定参数作为unicode对象传递,因为PyMySQL通常在内部使用字符串插值来生成最终语句,而在executemany的情况下,仅在最后语句中执行“编码”步骤。¶ T0>

    参考文献:#3337

  • [mysql] [bug] [py3k] 修正了Py3K上没有正确使用ord()函数的mysql.BIT类型。请求礼貌David Marin。

    参考文献:#3333请求github:158

源码¶ T0>

  • [sqlite] [bug] Fixed bug in SQLite dialect where reflection of UNIQUE constraints that included non-alphabetic characters in the names, like dots or spaces, would not be reflected with their name.

    参考文献:#3495

杂项¶ T0>

  • [bug] [ext] Fixed bug where when using extended attribute instrumentation system, the correct exception would not be raised when class_mapper() were called with an invalid input that also happened to not be weak referencable, such as an integer.

    参考文献:#3408

  • [bug] [tests] [pypy] 修正了阻止“pypy setup.py test”正常工作的导入。

    参考文献:#3406

  • [bug] [ext] 固定从0.9.9开始的回归,其中as_declarative()符号已从sqlalchemy.ext.declarative名称空间中移除。 ¶ T7>

    参考文献:#3324

0.9.9 ¶ T0>

发布日期:2015年3月10日

ORM ¶ T0>

  • [orm] [feature] 添加了一个新参数Session.connection.execution_options,它可用于在Connection上设置执行选项在交易开始之前首先检查出来。这用于在事务启动之前设置连接上的隔离级别等选项。

    也可以看看

    Setting Transaction Isolation Levels - 新的文档部分详细介绍了使用会话设置事务隔离的最佳实践。

    参考文献:#3296

  • [orm] [feature] Added new method Session.invalidate(), functions similarly to Session.close(), except also calls Connection.invalidate() on all connections, guaranteeing that they will not be returned to the connection pool. 这在例如情况下是有用的在进一步使用连接不安全时处理gevent超时,即使是回滚。

  • [orm] [bug] Fixed bugs in ORM object comparisons where comparison of many-to-one != None would fail if the source were an aliased class, or if the query needed to apply special aliasing to the expression due to aliased joins or polymorphic querying; also fixed bug in the case where comparing a many-to-one to an object state would fail if the query needed to apply special aliasing due to aliased joins or polymorphic querying.

    参考文献:#3310

  • 修正了在Sessionafter_rollback()处理程序错误地将状态添加到内部断言的情况下会失败的问题。[orm] [bug] Session处理程序中,以及警告和移除此状态的任务(由#2389建立)尝试继续。

    参考文献:#3309

  • [orm] [bug] Fixed bug where TypeError raised when Query.join() called with unknown kw arguments would raise its own TypeError due to broken formatting. 请求Malthe Borch提出请求。

    参考文献:请求github:147

  • [orm] [bug] Fixed bug in lazy loading SQL construction whereby a complex primaryjoin that referred to the same “local” column multiple times in the “column that points to itself” style of self-referential join would not be substituted in all cases. 这里确定替代的逻辑已被重新设计为更加开放。

    参考文献:#3300

  • [orm] [bug] “通配符”加载器选项,特别是由orm.load_only()选项设置的选项,以覆盖未明确提及的所有属性,现在考虑给定实体的超类,如果该实体使用继承映射进行映射,那么超类中的属性名也从加载中省略。此外,多态判别器列无条件地包含在列表中,就像主键列一样,所以即使设置了load_only(),子类型的多态加载也能正常运行。¶ t0 >

    参考文献:#3287

  • [orm] [bug] [pypy] Fixed bug where if an exception were thrown at the start of a Query before it fetched results, particularly when row processors can’t be formed, the cursor would stay open with results pending and not actually be closed. 对于像Pypy这样的解释器来说,这通常只是一个问题,在这种解释器中,光标没有立即被GC化,并且在某些情况下会导致事务/锁的打开时间超过所需的时间。

    参考文献:#3285

  • [orm] [bug] Fixed a leak which would occur in the unsupported and highly non-recommended use case of replacing a relationship on a fixed mapped class many times, referring to an arbitrarily growing number of target mappers. 当旧的关系被替换时发出警告,但是如果映射已经用于查询,旧的关系仍然会在一些注册表中被引用。

    参考文献:#3251

  • [orm] [bug] [sqlite] Fixed bug regarding expression mutations which could express itself as a “Could not locate column” error when using Query to select from multiple, anonymous column entities when querying against SQLite, as a side effect of the “join rewriting” feature used by the SQLite dialect.

    参考文献:#3241

  • [orm] [bug] Fixed bug where the ON clause for Query.join(), and Query.outerjoin() to a single-inheritance subclass using of_type() would not render the “single table criteria” in the ON clause if the from_joinpoint=True flag were set.

    参考文献:#3232

发动机¶ T0>

SQL ¶ T0>

  • [sql] [bug] native_enum标志添加到Enum__repr__()与Alembic自动生成一起使用时很重要。拉请求礼貌Dimitris Theodorou。

    参考文献:pull request bitbucket:41

  • [sql] [bug] Fixed bug where using a TypeDecorator that implemented a type that was also a TypeDecorator would fail with Python’s “Cannot create a consistent method resolution order (MRO)” error, when any kind of SQL comparison expression were used against an object using this type.

    参考文献:#3278

  • [sql] [bug] Fixed issue where the columns from a SELECT embedded in an INSERT, either through the values clause or as a “from select”, would pollute the column types used in the result set produced by the RETURNING clause when columns from both statements shared the same name, leading to potential errors or mis-adaptation when retrieving the returning rows.

    参考文献:#3248

架构¶ T0>

  • [schema] [bug] Fixed bug in 0.9’s foreign key setup system, such that the logic used to link a ForeignKey to its parent could fail when the foreign key used “link_to_name=True” in conjunction with a target Table that would not receive its parent column until later, such as within a reflection + “useexisting” scenario, if the target column in fact had a key value different from its name, as would occur in reflection if column reflect events were used to alter the .key of reflected Column objects so that the link_to_name becomes significant. 当目标列具有不同的键并使用link_to_name引用时,也通过类似的方式修复了对列类型的支持。

    参考文献:#3298#1765

的PostgreSQL ¶ T0>

  • [postgresql] [feature] 使用postgresql_concurrently添加了对使用Postgresql索引的CONCURRENTLY关键字的支持。请求Iuri de Silvio提出请求。

    参考:拉请求bitbucket:45

  • [postgresql] [bug] 使用psycopg2时修复了对Postgresql UUID类型与ARRAY类型的支持。psycopg2方言现在使用psycopg2.extras.register_uuid()挂钩,以便始终将UUID值作为UUID()对象传递给DBAPI或从DBAPI传递。UUID.as_uuid标志仍然有效,除非使用psycopg2,否则我们需要在禁用时将返回的UUID对象转换回字符串。

    参考文献:#2940

  • [postgresql] [bug] Added support for the postgresql.JSONB datatype when using psycopg2 2.5.4 or greater, which features native conversion of JSONB data so that SQLAlchemy’s converters must be disabled; additionally, the newly added psycopg2 extension extras.register_default_jsonb is used to establish a JSON deserializer passed to the dialect via the json_deserializer argument. 还修复了Postgresql集成测试,它实际上并未将JSONB类型与JSON类型相反。请求Mateusz Susik提供。

    参考文献:请求github:145

  • [postgresql] [bug] 在注册HSTORE类型时,修复了使用“array_oid”标志的旧版psycopg2版本<2.4.3,该版本不支持该标志,以及使用native json串行器钩子“register_default_json”与用户定义的json_deserializer在psycopg2版本<2.5上,其中不包含本地json

  • [postgresql] [bug] Fixed bug where Postgresql dialect would fail to render an expression in an Index that did not correspond directly to a table-bound column; typically when a text() construct was one of the expressions within the index; or could misinterpret the list of expressions if one or more of them were such an expression.

    参考文献:#3174

MySQL的¶ T0>

  • [mysql] [bug] 增加了对'utf8_bin'排序检查周围的MySQLdb方言的版本检查,因为这在MySQL服务器<5.0中失败。

    参考文献:#3274

  • [mysql] [change] gaerdbms方言不再需要,并且发出弃用警告。Google现在建议直接使用MySQLdb方言。

    参考文献:#3275

源码¶ T0>

  • [sqlite] [feature] 在SQLite中增加了对部分索引(例如使用WHERE子句)的支持。请求Kai Groner提供的请求。

    也可以看看

    Partial Indexes

    参考文献:pull request bitbucket:42

  • [sqlite] [feature] 为SQLCipher后端添加了新的SQLite后端。该后端使用pysqlcipher Python驱动程序提供加密的SQLite数据库,这与pysqlite驱动程序非常相似。

    也可以看看

    pysqlcipher

杂项¶ T0>

  • [bug] [ext] [py3k] Fixed bug where the association proxy list class would not interpret slices correctly under Py3K. 拉尔请求礼貌Gilles Dartiguelongue。

    参考文献:请求github:154

  • [bug] [examples] Updated the Versioning with a History Table example such that mapped columns are re-mapped to match column names as well as grouping of columns; in particular, this allows columns that are explicitly grouped in a same-column-named joined inheritance scenario to be mapped in the same way in the history mappings, avoiding warnings added in the 0.9 series regarding this pattern and allowing the same view of attribute keys.

  • [bug] [examples] Fixed a bug in the examples/generic_assocaitions/discriminator_on_association.py example, where the subclasses of AddressAssociation were not being mapped as “single table inheritance”, leading to problems when trying to use the mappings further.

0.9.8 ¶ T0>

发布日期:2014年10月13日

ORM ¶ T0>

  • [orm] [bug] [engine] Fixed bug that affected generally the same classes of event as that of #3199, when the named=True parameter would be used. 一些事件将无法注册,而其他事件不会正确地调用事件参数,通常是在事件被“包装”以便以其他方式进行适应的情况下。“命名”机制已重新排列,不会干扰内部包装函数期望的参数签名。

    参考文献:#3197

  • [orm] [bug] Fixed bug that affected many classes of event, particularly ORM events but also engine events, where the usual logic of “de duplicating” a redundant call to event.listen() with the same arguments would fail, for those events where the listener function is wrapped. 断言将在registry.py中发生。这一说法现在已经被纳入重复数据删除检查中,并带来更简单的方法来检查重复数据删除的额外好处。

    参考文献:#3199

  • [orm] [bug] 固定警告,当复杂的自引用primaryjoin包含函数时会发出警告,同时指定remote_side;警告会建议设置“远程端”。如果remote_side不存在,它现在只会发射。

    参考文献:#3194

orm declarative

  • [bug] [declarative] [orm] Fixed “‘NoneType’ object has no attribute ‘concrete’” error when using AbstractConcreteBase in conjunction with a subclass that declares __abstract__.

    参考文献:#3185

发动机¶ T0>

  • [engine] [bug] The execution options passed to an Engine either via create_engine.execution_options or Engine.update_execution_options() are not passed to the special Connection used to initialize the dialect within the “first connect” event; dialects will usually perform their own queries in this phase, and none of the current available options should be applied here. 特别是,“自动提交”选项会导致尝试在此初始连接中自动提交,由于Connection的非标准状态,该选项将因AttributeError失败。

    参考文献:#3200

  • [engine] [bug] 用于确定受INSERT或UPDATE影响的列的字符串键现在在对“编译缓存”缓存键作出贡献时被排序。这些键以前没有确定性地排序,这意味着相同的语句可以在相同的键上多次缓存,从内存和性能两个方面来说都是这样。

    参考文献:#3165

SQL ¶ T0>

  • [sql] [bug] Fixed bug where a fair number of SQL elements within the sql package would fail to __repr__() successfully, due to a missing description attribute that would then invoke a recursion overflow when an internal AttributeError would then re-invoke __repr__().

    参考文献:#3195

  • [sql] [bug] An adjustment to table/index reflection such that if an index reports a column that isn’t found to be present in the table, a warning is emitted and the column is skipped. 对于一些特殊的系统列情况,可能会发生这种情况,正如Oracle观察到的那样。

    参考文献:#3180

  • [sql] [bug] Fixed bug in CTE where literal_binds compiler argument would not be always be correctly propagated when one CTE referred to another aliased CTE in a statement.

    参考文献:#3154

  • [sql] [bug] 修正了由#3067导致的0.9.7回归与错误的单元测试的结合,使得所谓的“模式”类型如BooleanEnum不能再被腌制。

    参考文献:#3144#3067

的PostgreSQL ¶ T0>

  • [postgresql] [feature] [pg8000] 通过pg8000驱动程序为“理智的多行数”添加支持,主要适用于使用ORM进行版本控制时。该功能基于使用的pg8000 1.9.14或更高版本进行版本检测。拉托洛克洛请求礼貌。

    参考文献:请求github:125

  • [postgresql] [bug] 重新审视此问题在0.9.5中首次被修补,显然psycopg2的.closed访问器并不像我们假设的那样可靠,所以我们添加了一个当检测到is-disconnect场景时,显式检查异常消息“SSL SYSCALL错误:错误的文件描述符”和“SSL SYSCALL错误:EOF检测到”。我们将继续咨询psycopg2的connection.closed作为第一次检查。

    参考文献:#3021

  • [postgresql] [bug] Fixed bug where Postgresql JSON type was not able to persist or otherwise render a SQL NULL column value, rather than a JSON-encoded 'null'. 为了支持这种情况,更改如下:

    • 现在可以指定null()值,这将始终导致产生该语句的NULL值。
    • 添加了一个新参数JSON.none_as_null,当True表示Python None值应该作为SQL NULL执行,而不是JSON编码'null'

    对于非psycopg2的DBAPI,即pg8000,也会修复NULL的空值。

    参考文献:#3159

  • [postgresql] [bug] DBAPI错误的异常包装系统现在可以容纳非标准DBAPI异常,例如psycopg2 TransactionRollbackError。这些异常现在将使用sqlalchemy.exc中最接近的可用子类进行引发,如果是TransactionRollbackError,sqlalchemy.exc.OperationalError

    参考文献:#3075

  • [postgresql] [bug] 修正了postgresql.array对象中的一个错误,其中与普通Python列表的比较将无法使用正确的数组构造函数。拉请求礼貌Andrew。

    参考文献:#3141请求github:124

  • [postgresql] [bug] 为函数添加了支持的FunctionElement.alias()方法。 func构造。以前,此方法的行为未定义。当前行为模仿0.9.4之前的行为,即该函数被转换为具有给定别名的单列FROM子句,其中列本身是匿名命名的。

    参考文献:#3137

MySQL的¶ T0>

  • [mysql] [bug] [mysqlconnector] Mysqlconnector as of version 2.0, probably as a side effect of the python 3 merge, now does not expect percent signs (e.g. as used as the modulus operator and others) to be doubled, even when using the “pyformat” bound parameter format (this change is not documented by Mysqlconnector). 当检测模运算符是否应该呈现为%%%时,方言现在检查py2k和mysqlconnector小于2.0版。

  • [mysql] [bug] [mysqlconnector] Unicode SQL现在传递给MySQLconnector 2.0及更高版本;对于Py2k和MySQL <2.0,字符串被编码。

源码¶ T0>

  • [sqlite] [bug] When selecting from a UNION using an attached database file, the pysqlite driver reports column names in cursor.description as ‘dbname.tablename.colname’, instead of ‘tablename.colname’ as it normally does for a UNION (note that it’s supposed to just be ‘colname’ for both, but we work around it). 此处的列转换逻辑已被调整为检索最右侧的标记,而不是第二个标记,因此它适用于这两种情况。解决方法礼貌Tony Roberts。

    参考文献:#3211

MSSQL ¶ T0>

  • [mssql] [bug] 修复了pymssql方言中的版本字符串检测问题,以便与Microsoft SQL Azure一起使用,它将单词“SQL Server”更改为“SQL Azure”。¶ t2 >

    参考文献:#3151

预言¶ T0>

  • [oracle] [bug] Fixed long-standing bug in Oracle dialect where bound parameter names that started with numbers would not be quoted, as Oracle doesn’t like numerics in bound parameter names.

    参考文献:#2138

杂项¶ T0>

  • [bug] [declarative] Fixed an unlikely race condition observed in some exotic end-user setups, where the attempt to check for “duplicate class name” in declarative would hit upon a not-totally-cleaned-up weak reference related to some other class being removed; the check here now ensures the weakref still references an object before calling upon it further.

    参考文献:#3208

  • [bug] [ext] 修正了订购清单中的bug,如果reorder_on_append标志被设置为True,则在收集替换事件期间将抛出物品的顺序。该修复确保排序列表仅影响与该对象显式关联的列表。

    参考文献:#3191

  • 修正了ext.mutable.MutableDict无法实现update()字典方法的错误,因此无法捕捉更改。[bug] [ext] 拉请求马特Chisholm。

  • [bug] [ext] Fixed bug where a custom subclass of ext.mutable.MutableDict would not show up in a “coerce” operation, and would instead return a plain ext.mutable.MutableDict. 拉请求马特Chisholm。

  • [bug] [pool] Fixed bug in connection pool logging where the “connection checked out” debug logging message would not emit if the logging were set up using logging.setLevel(), rather than using the echo_pool flag. 已经添加了测试来声明这个日志记录。这是在0.9.0中引入的回归。

    参考文献:#3168

0.9.7 ¶ T0>

发布日期:2014年7月22日

ORM ¶ T0>

  • [orm] [bug] [eagerloading] Fixed a regression caused by #2976 released in 0.9.4 where the “outer join” propagation along a chain of joined eager loads would incorrectly convert an “inner join” along a sibling join path into an outer join as well, when only descendant paths should be receiving the “outer join” propagation; additionally, fixed related issue where “nested” join propagation would take place inappropriately between two sibling join paths.

    参考文献:#3131

  • [orm] [bug] Fixed a regression from 0.9.0 due to #2736 where the Query.select_from() method no longer set up the “from entity” of the Query object correctly, so that subsequent Query.filter_by() or Query.join() calls would fail to check the appropriate “from” entity when searching for attributes by string name.

    参考文献:#2736#3083

  • [orm] [bug] The “evaluator” for query.update()/delete() won’t work with multi-table updates, and needs to be set to synchronize_session=False or synchronize_session=’fetch’; a warning is now emitted. 在1.0中,这将被提升为一个完整的例外。

    参考文献:#3117

  • [orm] [bug] Fixed bug where items that were persisted, deleted, or had a primary key change within a savepoint block would not participate in being restored to their former state (not in session, in session, previous PK) after the outer transaction were rolled back.

    参考文献:#3108

  • [orm] [bug] Fixed bug in subquery eager loading in conjunction with with_polymorphic(), the targeting of entities and columns in the subquery load has been made more accurate with respect to this type of entity and others.

    参考文献:#3106

  • [orm] [bug] 修复了涉及动态属性的错误,这又是从版本0.9.5开始的#3060的回归。与lazy ='dynamic'的自引用关系会在flush操作中引发TypeError。

    参考文献:#3099

发动机¶ T0>

SQL ¶ T0>

  • [sql] [bug] Fixed bug in Enum and other SchemaType subclasses where direct association of the type with a MetaData would lead to a hang when events (like create events) were emitted on the MetaData.

    这个改变也被回退为:0.8.7

    参考文献:#3124

  • [sql] [bug] Fixed a bug within the custom operator plus TypeEngine.with_variant() system, whereby using a TypeDecorator in conjunction with variant would fail with an MRO error when a comparison operator was used.

    这个改变也被回退为:0.8.7

    参考文献:#3102

  • [sql] [bug] Fix bug in naming convention feature where using a check constraint convention that includes constraint_name would then force all Boolean and Enum types to require names as well, as these implicitly create a constraint, even if the ultimate target backend were one that does not require generation of the constraint such as Postgresql. 这些特定约束的命名约定的机制已重新组织,以便在DDL编译时完成命名确定,而不是在约束/表构造时完成命令。

    参考文献:#3067

  • [sql] [bug] Fixed bug in common table expressions whereby positional bound parameters could be expressed in the wrong final order when CTEs were nested in certain ways.

    参考文献:#3090

  • 修正了多值Insert构造无法检查给定的字面SQL表达式第一个以后的值的问题。[sql] [bug]

    参考文献:#3069

  • [sql] [bug] 在Python版本<2.6.5的dialect_kwargs迭代中添加了一个“str()”步骤,解决了“no unicode keyword arg”关键字在一些反射过程中引用。

    参考文献:#3123

  • [sql] [bug] The TypeEngine.with_variant() method will now accept a type class as an argument which is internally converted to an instance, using the same convention long established by other constructs such as Column.

    参考文献:#3122

的PostgreSQL ¶ T0>

  • [postgresql] [feature] 添加kw参数postgresql_regconfigColumnOperators.match()运算符,允许指定“reg config”参数发送到to_tsquery()函数。请求Jonathan Vanasco提供。

    References: #3078, pull request bitbucket:22

  • [postgresql] [feature] 通过JSONB增加了对Postgresql JSONB的支持。请求礼貌Damian Dimmich。

    参考文献:请求github:101

  • [postgresql] [bug] [pg8000] 修正了0.9.5版本中新增的pg8000隔离级别功能导致的错误,其中引擎级别的隔离级别参数会在连接时产生错误¶ t2 >

    参考文献:#3134

MySQL的¶ T0>

  • [mysql] [bug] MySQL error 2014 “commands out of sync” appears to be raised as a ProgrammingError, not OperationalError, in modern MySQL-Python versions; all MySQL error codes that are tested for “is disconnect” are now checked within OperationalError and ProgrammingError regardless.

    这个改变也被回退为:0.8.7

    参考文献:#3101

源码¶ T0>

  • [sqlite] [bug] Fixed a SQLite join rewriting issue where a subquery that is embedded as a scalar subquery such as within an IN would receive inappropriate substitutions from the enclosing query, if the same table were present inside the subquery as were in the enclosing query such as in a joined inheritance scenario.

    参考文献:#3130

MSSQL ¶ T0>

  • [mssql] [feature] 为SQL Server 2008启用“多值插入”。拉尔请求Albert Cervin礼貌。还扩展了对“IDENTITY INSERT”模式的检查,以便在语句的VALUE子句中存在身份钥匙时包含该身份钥匙。

    参考文献:请求github:98

  • [mssql] [bug] Added statement encoding to the “SET IDENTITY_INSERT” statements which operate when an explicit INSERT is being interjected into an IDENTITY column, to support non-ascii table identifiers on drivers such as pyodbc + unix + py2k that don’t support unicode statements.

    这个改变也被回退为:0.8.7

  • [mssql] [bug] In the SQL Server pyodbc dialect, repaired the implementation for the description_encoding dialect parameter, which when not explicitly set was preventing cursor.description from being parsed correctly in the case of result sets that contained names in alternate encodings. 这个参数不应该被继续使用。

    这个改变也被回退为:0.8.7

    参考文献:#3091

  • [mssql] [bug] 修复了由#3025引起的0.9.5的回归,其中用于确定“默认模式”的查询在SQL Server 2000中无效。对于SQL Server 2000,我们回到缺省方言的“模式名称”参数,该参数是可配置的,但默认为'dbo'。

    参考文献:#3025

预言¶ T0>

  • [oracle] [bug] [tests] Fixed bug in oracle dialect test suite where in one test, ‘username’ was assumed to be in the database URL, even though this might not be the case.

    参考文献:#3128

杂项¶ T0>

  • [bug] [tests] 修正了“python setup.py test”没有正确调用distutils的错误,并且在测试套件结束时会发出错误。 T2>

  • [bug] [declarative] Fixed bug when the declarative __abstract__ flag was not being distinguished for when it was actually the value False. __abstract__标志需要在被测试的级别上进行真实值计算。

    参考文献:#3097

0.9.6 ¶ T0>

发布日期:2014年6月23日

ORM ¶ T0>

0.9.5 ¶ T0>

发布日期:2014年6月23日

ORM ¶ T0>

  • [orm] [feature] The “primaryjoin” model has been stretched a bit further to allow a join condition that is strictly from a single column to itself, translated through some kind of SQL function or expression. 这是一种实验,但概念的第一个证明是“物化路径”连接条件,其中路径字符串使用“like”与自身进行比较。ColumnOperators.like()运算符也被添加到在primaryjoin条件中使用的有效运算符列表中。

    参考文献:#3029

  • [orm] [feature] 添加了新的实用程序函数make_transient_to_detached(),可用于制造表现如同从会话加载,然后分离的对象。不存在的属性被标记为过期,并且该对象可以被添加到会话中,它将像一个持久的行为一样。

    参考文献:#3017

  • [orm] [bug] Fixed bug in subquery eager loading where a long chain of eager loads across a polymorphic-subclass boundary in conjunction with polymorphic loading would fail to locate the subclass-link in the chain, erroring out with a missing property name on an AliasedClass.

    这个改变也被回退为:0.8.7

    参考文献:#3055

  • [orm] [bug] Fixed ORM bug where the class_mapper() function would mask AttributeErrors or KeyErrors that should raise during mapper configuration due to user errors. 对属性/键错误的捕获更具体,不包括配置步骤。

    这个改变也被回退为:0.8.7

    参考文献:#3047

  • [orm] [bug] Additional checks have been added for the case where an inheriting mapper is implicitly combining one of its column-based attributes with that of the parent, where those columns normally don’t necessarily share the same value. 这是通过#1892添加的现有支票的扩展。然而,这个新的检查仅发出警告,而不是例外,以允许可能依赖现有行为的应用程序。

    参考文献:#3042

  • [orm] [bug] Modified the behavior of orm.load_only() such that primary key columns are always added to the list of columns to be “undeferred”; otherwise, the ORM can’t load the row’s identity. 显然,可以推迟映射的主键,并且ORM将失败,这并没有改变。But as load_only is essentially saying “defer all but X”, it’s more critical that PK cols not be part of this deferral.

    参考文献:#3080

  • [orm] [bug] Fixed a few edge cases which arise in the so-called “row switch” scenario, where an INSERT/DELETE can be turned into an UPDATE. 在这种情况下,将多对一关系设置为无,或者在某些情况下将标量属性设置为无,可能不会将其检测为值的净更改,因此UPDATE不会重置上一行中的内容。这是由于一些尚未解决的方式属性历史的工作方式隐含地假设None不是真正的“改变”以前未设置的属性。另见#3061

    注意

    This change has been REVERTED in 0.9.6. 完整的修补程序将在SQLAlchemy 1.0版中。

    参考文献:#3060

  • [orm] [bug] #3060相关,已对工作单元进行了调整,以使相关的多对一对象的加载稍微更积极在要删除的自引用对象的图形的情况下;如果未设置passive_deletes,则相关对象的负载将帮助确定正确的删除顺序。

  • [orm] [bug] Fixed bug in SQLite join rewriting where anonymized column names due to repeats would not correctly be rewritten in subqueries. 这会影响任何类型的子查询+连接的SELECT查询。

    参考文献:#3057

  • [orm] [bug] [sql] Fixes to the newly enhanced boolean coercion in #2804 where the new rules for “where” and “having” woudn’t take effect for the “whereclause” and “having” kw arguments of the select() construct, which is also what Query uses so wasn’t working in the ORM either.

    参考文献:#3013

发动机¶ T0>

  • [engine] [bug] Fixed bug which would occur if a DBAPI exception occurs when the engine first connects and does its initial checks, and the exception is not a disconnect exception, yet the cursor raises an error when we try to close it. 在这种情况下,当我们试图通过连接池记录游标关闭异常并且失败时,真正的异常将被废除,因为我们试图以在这种特定情况下不合适的方式访问池的记录器。 T0>

    参考文献:#3063

  • [engine] [bug] Fixed some “double invalidate” situations were detected where a connection invalidation could occur within an already critical section like a connection.close(); ultimately, these conditions are caused by the change in #2907, in that the “reset on return” feature calls out to the Connection/Transaction in order to handle it, where “disconnect detection” might be caught. 然而,#2985中最近发生的变化可能会导致这种情况出现,因为“连接无效”操作的速度更快,因为问题在0.9.4上的可重复性高于0.9.3。

    现在在任何可能出现失效的部分添加检查,以暂停对失效的连接进一步禁止的操作。这包括在引擎级别和池级别的两个修补程序。虽然在高度并发的基因事件中观察到这个问题,但理论上可以发生在连接关闭操作内发生断开连接的任何情况下。

    参考文献:#3043

SQL ¶ T0>

  • [sql] [feature] 稍微放宽了Index的契约,因为您可以指定一个text()表达式作为目标;如果要通过内联声明或通过Table.append_constraint()将索引手动添加到表中,则索引不再需要存在表格绑定列。 T11>

    参考文献:#3028

  • [sql] [feature] Added new flag expression.between.symmetric, when set to True renders “BETWEEN SYMMETRIC”. 还添加了一个新的否定运算符“notbetween_op”,该运算符现在允许像〜col.between(x, y)这样的表达式呈现为“ col NOT BETWEEN x AND y“,而不是一个带括号的NOT字符串。

    参考文献:#2990

  • [sql] [bug] Fixed bug in INSERT..FROM SELECT construct where selecting from a UNION would wrap the union in an anonymous (e.g. unlabled) subquery.

    这个改变也被回退为:0.8.7

    参考文献:#3044

  • 修复了当Table.update()Table.delete()在空的时候会产生一个空的WHERE子句的问题。[sql] [bug] and_()or_()或其他空白表达。这与select()的一致。

    这个改变也被回退为:0.8.7

    参考文献:#3045

  • [sql] [bug] The Column.nullable flag is implicitly set to False when that Column is referred to in an explicit PrimaryKeyConstraint for that table. 这种行为现在与Column本身将Column.primary_key标志设置为True时的行为相匹配,该行为旨在成为一个完全等效的情况¶ T8>

    参考文献:#3023

  • [sql] [bug] Fixed bug where the Operators.__and__(), Operators.__or__() and Operators.__invert__() operator overload methods could not be overridden within a custom TypeEngine.Comparator implementation.

    参考文献:#3012

  • [sql] [bug] Fixed bug in new DialectKWArgs.argument_for() method where adding an argument for a construct not previously included for any special arguments would fail.

    参考文献:#3024

  • [sql] [bug] Fixed regression introduced in 0.9 where new “ORDER BY ” feature from #1068 would not apply quoting rules to the label name as rendered in the ORDER BY.

    参考文献:#1068#3020

  • [sql] [bug] Function的导入恢复到sqlalchemy.sql.expression导入命名空间,该空间在0.9开始时被删除¶ T7>

的PostgreSQL ¶ T0>

  • [postgresql] [feature] 在使用pg8000 DBAPI时增加了对AUTOCOMMIT隔离级别的支持。拉托洛克洛请求礼貌。

    参考文献:请求github:88

  • [postgresql] [feature] 将新标志ARRAY.zero_indexes添加到Postgresql ARRAY类型。当设置为True时,在传递到数据库之前,值为1将被添加到所有数组索引值,从而允许Python样式的基于零的索引和基于Postgresql one的索引之间具有更好的互操作性。请求礼貌Alexey Terentev。

    参考文献:#2785拉取请求bitbucket:18

  • [postgresql] [bug] 为PG HSTORE类型添加了hashable=False标志,这是允许ORM跳过尝试在混合列/实体列表中请求ORM映射的HSTORE列时“散列”。补丁礼貌GunnlaugurÞórBriem。

    这个改变也被回退为:0.8.7

    参考文献:#3053

  • [postgresql] [bug] 添加了一个新的“断开连接”消息“连接意外关闭”。这似乎与更新版本的SSL有关。拉提请求Antti Haapala礼貌。

    这个改变也被回退为:0.8.7

    参考:拉取请求bitbucket:13

  • [postgresql] [bug] 当确定异常是否为“断开”错误时,现在查阅psycopg2 .closed访问器;理想情况下,这应该不需要对异常消息进行任何其他检查来检测断开连接,但是我们将保留现有的消息作为后备消息。这应该能够处理新的情况,如“SSL EOF”条件。拉德请求礼貌德克米勒。

    参考文献:#3021请求github:87

  • [postgresql] [enhancement] 在Postgresql方言中添加了一个新类型的postgresql.OID虽然“oid”通常是PG中的私有类型,但在现代版本中并未公开,但有一些PG用例,例如可能暴露这些类型的大对象支持,以及某些用户报告的模式反射用例。 ¶ T0>

    参考文献:#3002

MySQL的¶ T0>

  • [mysql] [bug] Fixed bug where column names added to mysql_length parameter on an index needed to have the same quoting for quoted names in order to be recognized. 该修复使得引号是可选的,但也提供了旧的行为,以便与使用变通方法的向后兼容。

    这个改变也被回退为:0.8.7

    参考文献:#3085

  • [mysql] [bug] 增加了对使用等号在索引中包含KEY_BLOCK_SIZE的表来反映表的支持。拉请求礼貌肖恩McGivern。

    这个改变也被回退为:0.8.7

    参考文献:拉取请求bitbucket:15

MSSQL ¶ T0>

  • [mssql] [bug] Revised the query used to determine the current default schema name to use the database_principal_id() function in conjunction with the sys.database_principals view so that we can determine the default schema independently of the type of login in progress (e.g., SQL Server, Windows, etc).

    参考文献:#3025

火鸟¶ T0>

  • [firebird] [bug] Fixed bug where the combination of “limit” rendering as “SELECT FIRST n ROWS” using a bound parameter (only firebird has both), combined with column-level subqueries which also feature “limit” as well as “positional” bound parameters (e.g. qmark style) would erroneously assign the subquery-level positions before that of the enclosing SELECT, thus returning parameters which are out of order.

    参考文献:#3038

杂项¶ T0>

  • [feature] [examples] 添加了一个使用最新关系功能说明物化路径的新示例。Jack Zhou提供的例子。

    参考文献:pull request bitbucket:21

  • [bug] [declarative] The __mapper_args__ dictionary is copied from a declarative mixin or abstract class when accessed, so that modifications made to this dictionary by declarative itself won’t conflict with that of other mappings. 关于version_id_colpolymorphic_on参数的字典被修改,将内部的列替换为正式映射到本地类/表的列。¶ t4 >

    这个改变也被回退为:0.8.7

    参考文献:#3062

  • [bug] [ext] Fixed bug in mutable extension where MutableDict did not report change events for the setdefault() dictionary operation.

    这个改变也被回退为:0.8.7

    参考文献:#3093#3051

  • [bug] [ext] Fixed bug where MutableDict.setdefault() didn’t return the existing or new value (this bug was not released in any 0.8 version). 请求礼貌托马斯Hervé。

    这个改变也被回退为:0.8.7

    References: #3093, #3051, pull request bitbucket:24

  • [bug] [testsuite] In public test suite, shanged to use of String(40) from less-supported Text in StringTest.test_literal_backslashes. Pullreq礼貌Jan.

    参考:请求github:95

  • [bug] [tests] [py3k] 更正了运行测试时涉及imp模块和Python 3.3或更高版本的一些弃用警告。拉请求马特Chisholm。

    References: #2830, pull request bitbucket:2830

0.9.4 ¶ T0>

发布日期:2014年3月28日

一般¶ T0>

  • [general] [feature] 为pytest添加了支持以运行测试。除了鼻子之外,这个跑步者目前正在得到支持,并且可能会更喜欢前进。SQLAlchemy使用的鼻插件系统已经拆分出来,因此它也可以在pytest下运行。目前还没有计划放弃对鼻子的支持,我们希望测试套件本身可以继续尽可能不受测试平台的影响。有关使用pytest运行测试的更新信息,请参阅文件README.unittests.rst。

    通过多次指定--db和/或--dburi标志,测试插件系统也得到了增强,以支持一次运行多个数据库URL的测试。这不会为每个数据库运行整个测试套件,而是允许特定于某些后端的测试用例在运行测试时使用该后端。当使用pytest作为测试运行器时,系统还会多次运行特定的测试套件,每个数据库运行一次,特别是“方言套件”中的那些测试。计划是Alembic还将使用增强型系统,并允许Alembic在一次运行中针对多个后端运行迁移操作测试,包括Alembic本身未包含的第三方后端。第三方方言和扩展也被鼓励将SQLAlchemy的测试套件作为基础进行标准化;请参阅README.dialects.rst文件以了解从SQLAlchemy测试平台构建的背景。

  • [general] [bug] Adjusted setup.py file to support the possible future removal of the setuptools.Feature extension from setuptools. 如果此关键字不存在,则使用setuptools进行设置仍然会成功,而不会退回到distutils。可以通过设置DISABLE_SQLALCHEMY_CEXT环境变量来禁用C扩展构建。无论setuptools是否可用,该变量都适用。

    这个改变也是backported到:0.8.6

    参考文献:#2986

  • [general] [bug] Fixed some test/feature failures occurring in Python 3.4, in particular the logic used to wrap “column default” callables wouldn’t work properly for Python built-ins.

    参考文献:#2979

ORM ¶ T0>

  • [orm] [feature] 添加了新的参数orm.mapper.confirm_deleted_rows默认为True,表示一系列DELETE语句应该确认游标的行数与匹配的主键的数量相匹配;在大多数情况下(除了使用version_id时),此行为已被取消以支持自引用ON DELETE CASCADE的异常边缘情况;为了适应这种情况,该消息现在只是一个警告,而不是一个例外,并且该标志可用于指示一种映射,该映射需要这种性质的自引用级联删除。另请参阅#2403以了解原始更改的背景。

    参考文献:#3007

  • [orm] [feature] A warning is emitted if the MapperEvents.before_configured() or MapperEvents.after_configured() events are applied to a specific mapper or mapped class, as the events are only invoked for the Mapper target at the general level.

  • [orm] [feature] Added a new keyword argument once=True to event.listen() and event.listens_for(). 这是一个方便的功能,它将包装给定的侦听器,使其仅被调用一次。

  • [orm] [feature] relationship.innerjoin添加了一个新选项,用于指定字符串"nested"当设置为"nested"而不是True时,连接的“链接”将在现有外部连接的右侧加入内部连接,而不是链接为一串外连接。这可能应该是0.9发布时的默认行为,因为我们在ORM中引入了右嵌套连接的功能,但是我们现在将其保留为非默认值以避免更多的意外。

    参考文献:#2976

  • [orm] [bug] Fixed ORM bug where changing the primary key of an object, then marking it for DELETE would fail to target the correct row for DELETE.

    这个改变也是backported到:0.8.6

    参考文献:#3006

  • [orm] [bug] Fixed regression from 0.8.3 as a result of #2818 where Query.exists() wouldn’t work on a query that only had a Query.select_from() entry but no other entities.

    这个改变也是backported到:0.8.6

    参考文献:#2995

  • [orm] [bug] Improved an error message which would occur if a query() were made against a non-selectable, such as a literal_column(), and then an attempt was made to use Query.join() such that the “left” side would be determined as None and then fail. 现在可以明确检测到这种情况。

    这个改变也是backported到:0.8.6

  • [orm] [bug] sqlalchemy.orm.interfaces.__all__中删除了过期名称,并使用当前名称刷新,以便导入> *再次运作。

    这个改变也是backported到:0.8.6

    参考文献:#2975

  • [orm] [bug] Fixed a very old behavior where the lazy load emitted for a one-to-many could inappropriately pull in the parent table, and also return results inconsistent based on what’s in the parent table, when the primaryjoin includes some kind of discriminator against the parent table, such as and_(parent.id == child.parent_id, parent.deleted == False). 虽然这个主要连接对于一对多来说没有多大意义,但在应用于多对一时更为常见,并且一对多来自后向参考。在这种情况下,从child加载行将保持parent.deleted == False就像在查询中一样,因此将其放到FROM子句中并执行笛卡尔积。现在,新行为将适当替换该参数的本地“parent.deleted”值。尽管通常情况下,真实世界的应用程序可能都希望在任何情况下都使用不同的primaryjoin作为o2m端。

    参考文献:#2948

  • [orm] [bug] Improved the check for “how to join from A to B” such that when a table has multiple, composite foreign keys targeting a parent table, the relationship.foreign_keys argument will be properly interpreted in order to resolve the ambiguity; previously this condition would raise that there were multiple FK paths when in fact the foreign_keys argument should be establishing which one is expected.

    参考文献:#2965

  • [orm] [bug] 增加了对event.listen()标记的insert=True标记的支持带有映射器/实例事件。

  • [orm] [bug] [engine] Fixed bug where events set to listen at the class level (e.g. on the Mapper or ClassManager level, as opposed to on an individual mapped class, and also on Connection) that also made use of internal argument conversion (which is most within those categories) would fail to be removable.

    参考文献:#2973

  • [orm] [bug] Fixed regression from 0.8 where using an option like orm.lazyload() with the “wildcard” expression, e.g. "*", would raise an assertion error in the case where the query didn’t contain any actual entities. 这个断言是针对其他情况的,并且在无意中捕捉到这个断言。

  • [orm] [bug] [sqlite] 更多解决SQLite“加入重写”;在0.9.3发布之前实施的#2967修复影响了UNION包含嵌套连接的情况。“加入重写”是一种具有广泛可能性的特性,也是我们多年来推出的第一个错综复杂的“SQL重写”特性,所以我们对其进行了大量迭代(与急切加载在0.2 / 0.3系列中,多晶型负荷在0.4 / 0.5)。我们应该很快到那里,谢谢你的支持:)。

    参考文献:#2969

发动机¶ T0>

  • [engine] [feature] 为方言级事件添加了一些新的事件机制;初始实现允许事件处理程序重新定义任意方言在DBAPI游标上调用execute()或executemany()的特定机制。在这个半公开和实验性的新事件中,支持一些即将到来的事务相关的扩展。

  • [engine] [feature] An event listener can now be associated with a Engine, after one or more Connection objects have been created (such as by an orm Session or via explicit connect) and the listener will pick up events from those connections. 以前,性能问题只是在初始阶段将事件从Engine转移到Connection,但我们已经内联了一系列条件检查,以使其成为可能,而无需任何其他功能呼叫。¶ T6>

    参考文献:#2978

  • [engine] [bug] 在检测到“断开连接”条件时,Engine重新利用连接缓冲池的机制进行了重大改进;不是丢弃池并明确关闭连接,池将被保留,并更新“代”时间戳以反映当前时间,从而导致所有现有连接在下次检出时被回收。这大大简化了回收过程,消除了在唤醒等待旧池的连接尝试的需要,并消除了在回收操作期间可能创建的许多立即丢弃的“池”对象的争用情况。 T0>

    参考文献:#2985

  • [engine] [bug] The ConnectionEvents.after_cursor_execute() event is now emitted for the “_cursor_execute()” method of Connection; this is the “quick” executor that is used for things like when a sequence is executed ahead of an INSERT statement, as well as for dialect startup checks like unicode returns, charset, etc. 这里已经调用了ConnectionEvents.before_cursor_execute()事件。这里的“executemany”标志现在总是被设置为False,因为这个事件总是对应于一次执行。以前,如果我们代表executemany INSERT语句执行操作,则标志可能为True。

SQL ¶ T0>

  • [sql] [feature] 增加了对布尔值的文字渲染的支持,例如“true”/“false”或“1”/“0”。

  • [sql] [feature] 添加了一个新特性schema.conv(),其目的是将约束名称标记为已经应用了命名约定。Alembic 0.6.4版本中的Alembic迁移将使用此标记,以便在迁移脚本中显示约束条件,并标记名称已受命名约定。

  • [sql] [feature] The new dialect-level keyword argument system for schema-level constructs has been enhanced in order to assist with existing schemes that rely upon addition of ad-hoc keyword arguments to constructs.

    例如,诸如Index之类的结构将在构建之后再次接受Index.kwargs集合内的临时关键字参数:

    idx = Index('a', 'b')
    idx.kwargs['mysql_someargument'] = True

    为了适应在构建时允许自定义参数的用例,现在允许此注册:DialectKWArgs.argument_for()方法:

    Index.argument_for('mysql', 'someargument', False)
    
    idx = Index('a', 'b', mysql_someargument=True)

    参考文献:#2866#2962

  • [sql] [bug] Fixed bug in tuple_() construct where the “type” of essentially the first SQL expression would be applied as the “comparison type” to a compared tuple value; this has the effect in some cases of an inappropriate “type coersion” occurring, such as when a tuple that has a mix of String and Binary values improperly coerces target values to Binary even though that’s not what they are on the left side. tuple_() now expects heterogeneous types within its list of values.

    这个改变也是backported到:0.8.6

    参考文献:#2977

  • [sql] [bug] Fixed an 0.9 regression where a Table that failed to reflect correctly wouldn’t be removed from the parent MetaData, even though in an invalid state. Pullreq礼貌Roman Podoliaka。

    参考文献:#2988请求github:78

  • [sql] [bug] MetaData.naming_convention feature will now also apply to CheckConstraint objects that are associated directly with a Column instead of just on the Table.

  • [sql] [bug] Fixed bug in new MetaData.naming_convention feature where the name of a check constraint making use of the “%(constraint_name)s” token would get doubled up for the constraint generated by a boolean or enum type, and overall duplicate events would cause the “%(constraint_name)s” token to keep compounding itself.

    参考文献:#2991

  • [sql] [bug] Adjusted the logic which applies names to the .c collection when a no-name BindParameter is received, e.g. via sql.literal() or similar; the “key” of the bind param is used as the key within .c. 而不是呈现的名称。由于这些绑定在任何情况下都具有“匿名”名称,因此这允许个别绑定参数在可选择的范围内具有其自己的名称,如果它们未被标记的话。

    参考文献:#2974

  • [sql] [bug] 在呈现重复列时,FromClause.c集合的行为发生了一些变化。发出警告并替换同名旧栏的行为仍然存在一定程度;更换尤其是保持向后兼容性。但是,被替换的列仍然与集合._all_columns中的c集合保持关联,集合 tt>用于构造(如别名和联合),以处理c中的列更多地指向实际列在列中的列,而不是唯一的键名集。This helps with situations where SELECT statements with same-named columns are used in unions and such, so that the union can match the columns up positionally and also there’s some chance of FromClause.corresponding_column() still being usable here (it can now return a column that is only in selectable.c._all_columns and not otherwise named). 我们仍然需要确定这个清单最终可能在哪里,因此强调了新的集合。理论上它会成为iter(selectable.c)的结果,但这意味着迭代的长度将不再与keys()的长度匹配,并且需要检出行为。 T0>

    参考文献:#2974

  • [sql] [bug] Fixed issue in new TextClause.columns() method where the ordering of columns given positionally would not be preserved. This could have potential impact in positional situations such as applying the resulting TextAsFrom object to a union.

的PostgreSQL ¶ T0>

  • [postgresql] [feature] 启用了“理智的多行计数”检查psycopg2 DBAPI,因为它似乎在psycopg2 2.0.9中受支持。

    这个改变也是backported到:0.8.6

  • [postgresql] [bug] Fixed regression caused by release 0.8.5 / 0.9.3’s compatibility enhancements where index reflection on Postgresql versions specific to only the 8.1, 8.2 series again broke, surrounding the ever problematic int2vector type. 虽然int2vector支持从8.1开始的数组操作,但显然它只支持从8.3开始的对于varchar的CAST。

    这个改变也是backported到:0.8.6

    参考文献:#3000

MySQL的¶ T0>

  • [mysql] [bug] 调整了mysql-connector-python的设置;在Py2K中,“支持unicode语句”标志现在为False,因此SQLAlchemy会在发送到数据库之前将SQL字符串(注意:不是参数)编码为字节。这似乎允许所有与unicode相关的测试通过mysql连接器,包括那些使用非ascii表/列名称的测试,以及使用unicode在cursor.executemany()下的TEXT类型的一些测试。¶ T0>

预言¶ T0>

  • [oracle] [feature] 在cx_Oracle方言中添加了一个新的引擎选项coerce_to_unicode=True,该方法将Python c2_Oracle outputtypehandler方法恢复为Python 2下的Python unicode转换,在0.9.2中由于#2911尽管有性能方面的问题,但一些使用案例希望unicode coersion对所有字符串值都是无条件的。请求礼貌Christoph Zwerschke。

    参考文献:#2911请求github:74

  • [oracle] [bug] 增加了新的数据类型oracle.DATE,它是DateTime的子类。As Oracle has no “datetime” type per se, it instead has only DATE, it is appropriate here that the DATE type as present in the Oracle dialect be an instance of DateTime. 这个问题不会改变任何类型的行为,因为在任何情况下数据转换都由DBAPI处理,但改进的子类布局将有助于检查跨数据库兼容性类型的用例。还从Oracle方言中删除了大写的DATETIME,因为此类型在该上下文中不起作用。

    参考文献:#2987

杂项¶ T0>

  • [bug] [ext] Fixed bug in mutable extension as well as attributes.flag_modified() where the change event would not be propagated if the attribute had been reassigned to itself.

    这个改变也是backported到:0.8.6

    参考文献:#2997

  • [bug] [automap] [ext] 添加了对automap的支持,以便在两个处于已连接继承关系的类之间不应该创建关系的情况下,将子类链接回这些外键到超类。

    参考文献:#3004

  • [bug] [tests] 修复了一些错误的u''字符串,它们会阻止测试在Py3.2中传递。补丁礼貌Arfrever Frehtes Taifersar Arahesis。

    参考文献:#2980

  • [bug] [pool] Fixed small issue in SingletonThreadPool where the current connection to be returned might get inadvertently cleaned out during the “cleanup” process. 补丁礼貌jd23.

  • [bug] [ext] [py3k] Fixed bug in association proxy where assigning an empty slice (e.g. x[:] = [...]) would fail on Py3k.

  • [bug] [ext] Fixed a regression in association proxy caused by #2810 which caused a user-provided “getter” to no longer receive values of None when fetching scalar values from a target that is non-present. 此更改引入的None检查现在移入默认getter,因此用户提供的getter也将再次接收None值。

    参考文献:#2810

  • [bug] [examples] 修正了版本级别示例中的列级别INSERT默认值会阻止写入历史值NULL的错误。

0.9.3 ¶ T0>

发布日期:2014年2月19日

ORM ¶ T0>

  • [orm] [feature] 添加了新的MapperEvents.before_configured()事件,该事件允许在configure_mappers() __declare_first__()钩子在声明中补充__declare_last__()

  • [orm] [bug] Fixed bug where Query.get() would fail to consistently raise the InvalidRequestError that invokes when called on a query with existing criterion, when the given identity is already present in the identity map.

    这个改变也被backported修改为:0.8.5

    参考文献:#2951

  • [orm] [bug] [sqlite] Fixed bug in SQLite “join rewriting” where usage of an exists() construct would fail to be rewritten properly, such as when the exists is mapped to a column_property in an intricate nested-join scenario. 还修复了一个有点相关的问题,如果目标是别名表,而不是单独的别名列,那么在SELECT语句的columns子句上连接重写将失败。

    参考文献:#2967

  • [orm] [bug] Fixed an 0.9 regression where ORM instance or mapper events applied to a base class such as a declarative base with the propagate=True flag would fail to apply to existing mapped classes which also used inheritance due to an assertion. 另外,根据首次分配的方式,修复了在删除此类事件期间可能发生的属性错误。

    参考文献:#2949

  • [orm] [bug] 改进了组合属性的初始化逻辑,例如调用MyClass.attribute不需要执行configure mappers步骤。它会在没有任何错误的情况下工作。

    参考文献:#2935

  • [orm] [bug] More issues with [ticket:2932] first resolved in 0.9.2 where using a column key of the form <tablename>_<columnname> matching that of an aliased column in the text would still not match at the ORM level, which is ultimately due to a core column-matching issue. 添加了其他规则,以便在使用TextAsFrom构造或使用文字列时考虑列_label

    参考文献:#2932

orm declarative

发动机¶ T0>

  • [engine] [bug] [pool] Fixed a critical regression caused by #2880 where the newly concurrent ability to return connections from the pool means that the “first_connect” event is now no longer synchronized either, thus leading to dialect mis-configurations under even minimal concurrency situations.

    这个改变也被backported修改为:0.8.5

    参考文献:#2964#2880

SQL ¶ T0>

  • [sql] [bug] Fixed bug where calling Insert.values() with an empty list or tuple would raise an IndexError. 它现在产生一个空的插入结构,就像空字典一样。

    这个改变也被backported修改为:0.8.5

    参考文献:#2944

  • [sql] [bug] Fixed bug where in_() would go into an endless loop if erroneously passed a column expression whose comparator included the __getitem__() method, such as a column that uses the postgresql.ARRAY type.

    这个改变也被backported修改为:0.8.5

    参考文献:#2957

  • [sql] [bug] Fixed regression in new “naming convention” feature where conventions would fail if the referred table in a foreign key contained a schema name. 请求礼貌Thomas Farvour。

    参考文献:pull request github:67

  • [sql] [bug] Fixed bug where so-called “literal render” of bindparam() constructs would fail if the bind were constructed with a callable, rather than a direct value. 这阻止了ORM表达式使用“literal_binds”编译器标志进行呈现。

的PostgreSQL ¶ T0>

  • [postgresql] [feature] TypeEngine.python_type便利访问器添加到postgresql.ARRAY类型中。请求礼貌Alexey Terentev。

    参考:请求github:64

  • [postgresql] [bug] 增加了psycopg2断开连接检测的附加信息,“无法将数据发送到服务器”,补充了现有的“无法接收来自服务器的数据”并被用户观察到。 ¶ T2>

    这个改变也被backported修改为:0.8.5

    参考文献:#2936

  • [postgresql] [bug]

    Postgresql在Postgresql的旧版本(之前的版本)以及其他PG引擎(如Redshift)(假设Redshift的版本报告为<8.1)时对Postgresql反射行为的支持得到了改进。查询“索引”以及“主键”依赖于检查所谓的“int2vector”数据类型,该数据类型在8.1之前拒绝胁迫数组,导致查询中使用的“ANY()”运算符失败。当PG版本<8.1被使用时,大量的搜索引擎已经找到了非常黑客但推荐的PG核心开发者查询,因此索引和主键约束反映现在可用于这些版本。

    这个改变也被backported修改为:0.8.5

  • [postgresql] [bug] Revised this very old issue where the Postgresql “get primary key” reflection query were updated to take into account primary key constraints that were renamed; the newer query fails on very old versions of Postgresql such as version 7, so the old query is restored in those cases when server_version_info < (8, 0) is detected.

    这个改变也被backported修改为:0.8.5

    参考文献:#2291

  • [postgresql] [bug] 增加了对“show standard_conforming_strings”的新增dialect启动查询的服务器版本检测;因为这个变量是从PG 8.2开始添加的,所以我们跳过PG版本的查询,它们报告早于版本字符串的版本。

    参考文献:#2946

MySQL的¶ T0>

  • [mysql] [feature] 添加了新的特定于MySQL的mysql.DATETIME,其中包括小数秒支持;还增加了对mysql.TIMESTAMP的小数秒支持。DBAPI支持是有限的,尽管小数秒被MySQL Connector / Python支持。补丁由Geert JM Vanderkelen提供。

    这个改变也被backported修改为:0.8.5

    参考文献:#2941

  • [mysql] [bug] 添加了对分区 BYPARTITIONS MySQL的支持将表关键字指定为mysql_partition_by='value'mysql_partitions='value'Table拉玛请求提供Marcus McCurdy。

    这个改变也被backported修改为:0.8.5

    References: #2966, pull request bitbucket:12

  • [mysql] [bug] Fixed bug which prevented MySQLdb-based dialects (e.g. pymysql) from working in Py3K, where a check for “connection charset” would fail due to Py3K’s more strict value comparison rules. 这个调用在任何情况下都没有考虑到数据库版本,因为服务器版本在那时仍然是None,所以整个方法被简化为依赖于connection.character_set_name()。¶ t0 >

    这个改变也被backported修改为:0.8.5

    参考文献:#2933

  • [mysql] [bug] [cymysql] 修正了cymysql方言中诸如'33a-MariaDB'等版本字符串无法正确解析的错误。拉请求马特施密特。

    参考文献:#2934请求github:69

源码¶ T0>

  • [sqlite] [bug] The SQLite dialect will now skip unsupported arguments when reflecting types; such as if it encounters a string like INTEGER(5), the INTEGER type will be instantiated without the “5” being included, based on detecting a TypeError on the first attempt.

  • [sqlite] [bug] 支持已经添加到SQLite类型反射,以完全支持http://www.sqlite.org/datatype3.html中指定的“类型关联” T2>。在此方案中,位于类型名称中的INTCHARBLOBREAL等关键字通常会将类型与五个亲缘之一。请求礼貌Erich Blume。

    也可以看看

    Type Reflection

    参考文献:请求github:65

杂项¶ T0>

  • [feature] [examples] 为版本化行示例添加了可选的“changed”列,以及支持版本化的Table具有显式schema请求礼貌jplaverdure。

    参考文献:请求github:41

  • [bug] [ext] Fixed bug where the AutomapBase class of the new automap extension would fail if classes were pre-arranged in single or potentially joined inheritance patterns. 修复后的已连接继承问题也可能在使用DeferredReflection时潜在地适用。

0.9.2 ¶ T0>

发布时间:2014年2月2日

ORM ¶ T0>

  • [orm] [feature] 添加了一个新参数Operators.op.is_comparison该标志允许来自Operators.op()的自定义操作被视为“比较”操作符,因此可用于自定义relationship.primaryjoin条件。

    也可以看看

    Using custom operators in join conditions中使用自定义运算符

  • [orm] [feature] 为提供join()结构作为relationship.secondary的目标,支持得到了改进。复杂的relationship()连接条件。该更改包括对查询连接的调整,加入的预加载以不呈现SELECT子查询,更改为延迟加载以使“辅助”目标正确包含在SELECT中,并更改为声明以更好地支持指定join()对象以班级为目标。

    新的使用案例有点实验性,但增加了新的文档部分。

  • 当一个迭代器对象被传递给class_mapper()或类似的错误消息时,修正错误消息,其中错误将无法在字符串格式上呈现。[orm] [bug] Pullleq礼貌Kyle Stark。

    这个改变也被backported修改为:0.8.5

    参考文献:请求github:58

  • [orm] [bug] Fixed bug in new TextAsFrom construct where Column- oriented row lookups were not matching up to the ad-hoc ColumnClause objects that TextAsFrom generates, thereby making it not usable as a target in Query.from_statement(). 还修复了Query.from_statement()结构,使其不会将TextAsFrom误认为Select结构。当调用Text.columns()方法以适应text.typemap参数时,此bug也是0.9回归。

    参考文献:#2932

  • [orm] [bug] 在属性“set”操作的范围内添加了一个新的指令,用于在属性需要延迟加载“old”值的情况下禁用autoflush,如在替换一对一值或某种多对一时。此时的刷新否则会发生在属性为None且可能导致NULL违反的地方。

    参考文献:#2921

  • [orm] [bug] Fixed an 0.9 regression where the automatic aliasing applied by Query and in other situations where selects or joins were aliased (such as joined table inheritance) could fail if a user-defined Column subclass were used in the expression. 在这种情况下,子类将无法传播适应所需的ORM特定“注释”。“表达注解”系统已被纠正以解释这种情况。

    参考文献:#2918

  • [orm] [bug] Fixed a bug involving the new flattened JOIN structures which are used with joinedload() (thereby causing a regression in joined eager loading) as well as aliased() in conjunction with the flat=True flag and joined-table inheritance; basically multiple joins across a “parent JOIN sub” entity using different paths to get to a target class wouldn’t form the correct ON conditions. 在一个别名和连接类的情况下,在计算连接的“左侧”的机制中做出的调整/简化修复了这个问题。

    参考文献:#2908

发动机¶ T0>

  • [engine] [feature] [pool] 添加了一个新的池事件PoolEvents.invalidate()当DBAPI连接被标记为“invaldated”并从池中丢弃时调用。

SQL ¶ T0>

  • [sql] [feature] 增加了MetaData.reflect.**dialect_kwargs以支持反映的所有Table对象的方言级反射选项。¶ T8>

  • [sql] [feature] 添加了一项新功能,允许自动命名约定应用于ConstraintIndex对象。根据Wiki中的配方,新功能使用架构事件来设置名称,因为各种架构对象都相互关联。The events then expose a configuration system through a new argument MetaData.naming_convention. This system allows production of both simple and custom naming schemes for constraints and indexes on a per-MetaData basis.

    参考文献:#2923

  • [sql] [feature] 现在可以在PrimaryKeyConstraint对象上指定选项,与primary_key=True旗;使用没有列的PrimaryKeyConstraint对象来实现这个结果。

    Previously, an explicit PrimaryKeyConstraint would have the effect of those columns marked as primary_key=True being ignored; since this is no longer the case, the PrimaryKeyConstraint will now assert that either one style or the other is used to specify the columns, or if both are present, that the column lists match exactly. 如果PrimaryKeyConstraintTable中标记为primary_key=True的列中存在不一致的列,则会发出警告,并且列表的列仅从PrimaryKeyConstraint单独获取,就像以前版本中的情况一样。

    也可以看看

    PrimaryKeyConstraint

    参考文献:#2910

  • [sql] [feature] 增强了模式构造和某些SQL构造接受特定于方言的关键字参数的系统。This system includes commonly the Table and Index constructs, which accept a wide variety of dialect-specific arguments such as mysql_engine and postgresql_where, as well as the constructs PrimaryKeyConstraint, UniqueConstraint, Update, Insert and Delete, and also newly added kwarg capability to ForeignKeyConstraint and ForeignKey. 改变之处在于参与方言现在可以为这些结构指定可接受的参数列表,如果为特定方言指定了无效关键字,则允许引发参数错误。如果关键字的方言部分无法识别,则仅发出警告;尽管系统实际上会使用setuptools入口点来定位非本地方言,但仍支持在卸载该第三方方言的环境中使用某些特定方言特定参数的用例。方言也必须明确地选择加入这个系统,以便不使用这个系统的外部方言不会受到影响。

    参考文献:#2866

  • [sql] [bug] The behavior of Table.tometadata() has been adjusted such that the schema target of a ForeignKey will not be changed unless that schema matches that of the parent table. 也就是说,如果表“schema_a.user”具有“schema_b.order.id”的外键,则不论“schema”参数是否传递给Table.tometadata()但是,如果表“schema_a.user”引用“schema_a.order.id”,则会在父表和引用表上更新“schema_a”的存在。这是一种行为改变,因此不可能回到0.8;假设之前的行为是非常有问题的,并且不太可能有人依赖它。

    此外,还添加了一个新参数Table.tometadata.referred_schema_fn这指的是一个可调用函数,它将用于确定tometadata操作中遇到的任何ForeignKeyConstraint的新引用模式。这个可调用的函数可以用来恢复到之前的行为或者定制如何在每个约束的基础上处理引用的模式。

    参考文献:#2913

  • [sql] [bug] Fixed bug whereby binary type would fail in some cases if used with a “test” dialect, such as a DefaultDialect or other dialect with no DBAPI.

  • [sql] [bug] [py3k] Fixed bug where “literal binds” wouldn’t work with a bound parameter that’s a binary type. 一个类似但不同的问题在0.8中得到了解决。

  • [sql] [bug] Fixed regression whereby the “annotation” system used by the ORM was leaking into the names used by standard functions in sqlalchemy.sql.functions, such as func.coalesce() and func.max(). 在ORM属性中使用这些函数,从而生成它们的注释版本可能会破坏在SQL中呈现的实际函数名称。

    参考文献:#2927

  • [sql] [bug] Fixed 0.9 regression where the new sortable support for RowProxy would lead to TypeError when compared to non-tuple types as it attempted to apply tuple() to the “other” object unconditionally. The full range of Python comparison operators have now been implemented on RowProxy, using an approach that guarantees a comparison system that is equivalent to that of a tuple, and the “other” object is only coerced if it’s an instance of RowProxy.

    参考文献:#2924#2848

  • [sql] [bug] Table内联创建的UniqueConstraint将被跳过。Pullreq礼貌Derek Harland。

    参考:拉取请求bitbucket:11

  • [sql] [bug] [orm] Fixed the multiple-table “UPDATE..FROM” construct, only usable on MySQL, to correctly render the SET clause among multiple columns with the same name across tables. 这也将仅用于非主表的SET子句中用于绑定参数的名称更改为“_ ”;因为通常直接使用Column对象指定此参数,所以不应该对应用程序产生影响。 T1> T0>该修订对ORM中的Table.update()以及Query.update()生效。

    参考文献:#2912

架构¶ T0>

  • [schema] [bug] sqlalchemy.schema.SchemaVisitor还原到.schema模块。Pullreq礼貌Sean Dague。

    参考文献:请求github:57

的PostgreSQL ¶ T0>

  • [postgresql] [feature] 添加了一个新的方言级参数postgresql_ignore_search_path;这个参数被Table构造函数和MetaData.reflect()方法所接受。当用于Postgresql时,即使名称存在于search_path中,指定远程模式名称的外键引用表也将保留该模式名称;从0.7.3开始的默认行为就是search_path中的模式不会被复制到反映的ForeignKey对象。文档已经更新,详细描述了pg_get_constraintdef()函数的行为,以及postgresql_ignore_search_path特性如何基本确定我们是否会遵守此函数报告的模式限定或不。

    参考文献:#2922

MySQL的¶ T0>

  • [mysql] [bug] 添加到cymysql方言的一些缺失方法,包括_get_server_version_info()和_detect_charset()。Pullreq礼貌Hajime Nakagami。

    这个改变也被backported修改为:0.8.5

    参考文献:pull request github:61

  • [mysql] [bug] [sql] Added new test coverage for so-called “down adaptions” of SQL types, where a more specific type is adapted to a more generic one - this use case is needed by some third party tools such as sqlacodegen. 这个测试套件中需要修复的特定情况是将mysql.ENUM向下转换为types.Enum,并将SQLite日期类型转换为通用日期类型。adapt()方法需要在这里变得更具体,以抵消在基础TypeEngine中删除“catch all”**kwargs在0.9中被删除的类。

    参考文献:#2917

  • [mysql] [bug] MySQL CAST编译现在考虑了诸如“charset”和“collat​​ion”之类的字符串类型的方面。While MySQL wants all character- based CAST calls to use the CHAR type, we now create a real CHAR object at CAST time and copy over all the parameters it has, so that an expression like cast(x, mysql.TEXT(charset='utf8')) will render CAST(t.col AS CHAR CHARACTER SET utf8).

  • [mysql] [bug] Added new “unicode returns” detection to the MySQL dialect and to the default dialect system overall, such that any dialect can add extra “tests” to the on-first-connect “does this DBAPI return unicode directly?” detection. 在这种情况下,我们正在使用明确的“utf8_bin”排序规则类型(在检查此排序规则可用后)专门针对“utf8”编码添加一个检查以检测MySQLdb 1.2.3版中观察到的一些错误的unicode行为。虽然MySQLdb自1.2.4起解决了此问题,但此处的检查应防止回归。该更改还允许“unicode”检查登录引擎日志,这在以前并非如此。

    参考文献:#2906

  • [mysql] [bug] [engine] [pool] Connection now associates a new RootTransaction or TwoPhaseTransaction with its immediate _ConnectionFairy as a “reset handler” for the span of that transaction, which takes over the task of calling commit() or rollback() for the “reset on return” behavior of Pool if the transaction was not otherwise completed. 这解决了当没有显式回滚或提交时连接关闭时,像MySQL两阶段那样的挑剔事务将被正确关闭的问题(例如,在这种情况下,不再提出“XAER_RMFAIL” - 注意这仅在日志记录中显示因为异常不会在池重置内传播)。This issue would arise e.g. when using an orm Session with twophase set, and then Session.close() is called without an explicit rollback or commit. 此更改还具有以下效果,即在非自动提交模式下使用Session对象时,您现在将在日志中看到明确的“ROLLBACK”,无论会话被丢弃的方式如何。感谢Jeff Dairiki和Laurence Rowe将此问题隔离开来。

    参考文献:#2907

源码¶ T0>

  • [sqlite] [bug] Fixed bug whereby SQLite compiler failed to propagate compiler arguments such as “literal binds” into a CAST expression.

MSSQL ¶ T0>

预言¶ T0>

  • [oracle] [bug] It’s been observed that the usage of a cx_Oracle “outputtypehandler” in Python 2.xx in order to coerce string values to Unicode is inordinately expensive; even though cx_Oracle is written in C, when you pass the Python unicode primitive to cursor.var() and associate with an output handler, the library counts every conversion as a Python function call with all the requisite overhead being recorded; this despite the fact when running in Python 3, all strings are also unconditionally coerced to unicode but it does not incur this overhead, meaning that cx_Oracle is failing to use performant techniques in Py2K. 由于SQLAlchemy无法轻松地以每列为基础选择此类型的处理程序类型,因此无条件地组装处理程序,从而将开销添加到所有字符串访问。

    所以这个逻辑已经被SQLAlchemy自己的unicode转换系统所替代,现在它只在Py2K中对需要unicode的列起作用。当使用C扩展时,SQLAlchemy的系统似乎比cx_Oracle快2-3倍。此外,SQLAlchemy的unicode转换功能得到了增强,因此当需要“条件”转换器(现在需要用于Oracle后端)时,“已经是unicode”的检查现在在C中执行,不再引入大量开销。

    此更改对cx_Oracle后端有两个影响。一个是Py2K中没有被Unicode类型或convert_unicode = True明确请求的字符串值现在将返回为str,而不是unicode - 此行为与后端如MySQL。另外,当使用cx_Oracle后端请求unicode值时,如果C扩展名not被使用,现在每列有一个额外的isinstance()检查开销。这种权衡已经被制定出来,因为它可以被解决,并且不会给可能的大部分非Unicode字符串的Oracle结果列带来性能负担。

    参考文献:#2911

杂项¶ T0>

  • [bug] [examples] Added a tweak to the “history_meta” example where the check for “history” on a relationship-bound attribute will now no longer emit any SQL if the relationship is unloaded.

  • [bug] [pool] PoolEvents.reset()事件的参数名称已重命名为dbapi_connectionconnection_record预计这个相对较新且很少使用的事件的现有侦听器在任何情况下都会使用位置风格来接收参数。

  • [bug] [cextensions] [py3k] Fixed an issue where the C extensions in Py3K are using the wrong API to specify the top-level module function, which breaks in Python 3.4b2. Py3.4b2将PyMODINIT_FUNC改为返回“void”而不是PyObject *,所以我们现在确保使用“PyMODINIT_FUNC”而不是 PyObject *拉请求礼貌cgohlke。

    参考文献:请求github:55

0.9.1 ¶ T0>

发布时间:2014年1月5日

ORM ¶ T0>

  • [orm] [feature] [extensions] 添加了一个新的实验性扩展sqlalchemy.ext.automapThis extension expands upon the functionality of Declarative as well as the DeferredReflection class to produce a base class which automatically generates mapped classes and relationships based on table metadata.

  • [orm] [bug] [events] Fixed regression where using a functools.partial() with the event system would cause a recursion overflow due to usage of inspect.getargspec() on it in order to detect a legacy calling signature for certain events, and apparently there’s no way to do this with a partial object. 相反,我们跳过了传统支票并采用现代风格;检查本身现在只发生在SessionEvents.after_bulk_update和SessionEvents.after_bulk_delete事件中。如果分配给“部分”事件侦听器,那么这两个事件将需要新的签名样式。

    参考文献:#2905

  • [orm] [bug] Fixed bug where using new Session.info attribute would fail if the .info argument were only passed to the sessionmaker creation call but not to the object itself. Courtesy Robin Schoonover。

    参考文献:pull request bitbucket:9

  • [orm] [bug] Fixed regression where we don’t check the given name against the correct string class when setting up a backref based on a name, therefore causing the error “too many values to unpack”. 这与Py3k转换有关。

    参考文献:#2901

  • [orm] [bug] Fixed regression where we apparently still create an implicit alias when saying query(B).join(B.cs), where “C” is a joined inh class; however, this implicit alias was created only considering the immediate left side, and not a longer chain of joins along different joined-inh subclasses of the same base. 只要我们在这种情况下仍然隐含别名,行为就会被拨回一点,这样它就会在各种各样的情况下混淆右侧。

    参考文献:#2903

orm declarative

  • [bug] [orm] [declarative] Fixed an extremely unlikely memory issue where when using DeferredReflection to define classes pending for reflection, if some subset of those classes were discarded before the DeferredReflection.prepare() method were called to reflect and map the class, a strong reference to the class would remain held within the declarative internals. 这个“映射类的内部集合”现在使用对这些类本身的弱引用。

  • [bug] [orm] [declarative] 一个准回归,显然在0.8中,您可以在声明式中设置一个类级属性,以直接引用一个InstrumentedAttribute超类或类本身,它或多或少地像一个同义词;在0.9中,这没有设置足够的簿记来跟上来自#2789的更自由化的后退逻辑。尽管这个用例从来没有被直接考虑过,但是现在通过声明在“setattr()”级别以及设置子类时检测到,并且镜像/重命名属性现在设置为synonym()

    参考文献:#2900

SQL ¶ T0>

  • [sql] [feature] Conjunctions like and_() and or_() can now accept Python generators as a single argument, e.g.:

    and_(x == y for x, y in tuples)

    这里的逻辑查找单个参数*args,其中第一个元素是types.GeneratorType的实例。

架构¶ T0>

0.9.0 ¶ T0>

发布日期:2013年12月30日

ORM ¶ T0>

  • [orm] [feature] The exc.StatementError or DBAPI-related subclass now can accommodate additional information about the “reason” for the exception; the Session now adds some detail to it when the exception occurs within an autoflush. This approach is taken as opposed to combining FlushError with a Python 3 style “chained exception” approach so as to maintain compatibility both with Py2K code as well as code that already catches IntegrityError or similar.

  • [orm] [feature] [backrefs] Added new argument include_backrefs=True to the validates() function; when set to False, a validation event will not be triggered if the event was initated as a backref to an attribute operation from the other side.

    也可以看看

    include_backrefs=False option for @validates的include_backrefs = False选项

    参考文献:#1535

  • [orm] [feature] A new API for specifying the FOR UPDATE clause of a SELECT is added with the new Query.with_for_update() method, to complement the new GenerativeSelect.with_for_update() method. 请求提供Mario Lassnig提供的请求。

    也可以看看

    New FOR UPDATE support on select(), Query()上的新FOR UPDATE支持

    参考文献:请求github:42

  • [orm] [bug] 调整subqueryload()策略,确保查询在加载过程开始后运行;这是为了使得子查询优先于其他装载者,因为其他的加载者可能在错误的时间因为其他的预先/非加载情况而触及相同的属性。

    这个改变也被backported修改为:0.8.5

    参考文献:#2887

  • [orm] [bug] Fixed bug when using joined table inheritance from a table to a select/alias on the base, where the PK columns were also not same named; the persistence system would fail to copy primary key values from the base table to the inherited table upon INSERT.

    这个改变也被backported修改为:0.8.5

    参考文献:#2885

  • [orm] [bug] composite() will raise an informative error message when the columns/attribute (names) passed don’t resolve to a Column or mapped attribute (such as an erroneous tuple); previously raised an unbound local.

    这个改变也被backported修改为:0.8.5

    参考文献:#2889

  • [orm] [bug] Fixed a regression introduced by #2818 where the EXISTS query being generated would produce a “columns being replaced” warning for a statement with two same-named columns, as the internal SELECT wouldn’t have use_labels set.

    这个改变也被backported修改为:0.8.4

    参考文献:#2818

  • [orm] [bug] [collections] [py3k] Added support for the Python 3 method list.clear() within the ORM collection instrumentation system; pull request courtesy Eduardo Schettino.

    参考文献:请求github:40

  • [orm] [bug] 关于描述符的一些改进,如混合,同义词,合成,用户定义的描述符等。AliasedClass继续进行的属性适配变得更加健壮,例如,如果描述符返回另一个插装属性,而不是复合SQL表达式元素,则操作仍将继续。Addtionally, the “adapted” operator will retain its class; previously, a change in class from InstrumentedAttribute to QueryableAttribute (a superclass) would interact with Python’s operator system such that an expression like aliased(MyClass.x) > MyClass.x would reverse itself to read myclass.x < myclass_1.x. 修改后的属性也会将新的AliasedClass作为它的父项,这在以前并不总是这样。

    参考文献:#2872

  • [orm] [bug] The viewonly flag on relationship() will now prevent attribute history from being written on behalf of the target attribute. 如果对象没有被写入Session.dirty列表,如果它发生了变化,这会产生影响。以前,该对象将出现在Session.dirty中,但在刷新期间不会发生代表修改后的属性的更改。该属性仍然会发出诸如backref事件和用户定义的事件之类的事件,并且仍然会从backrefs中接收到突变。

    参考文献:#2833

  • [orm] [bug] 添加了对新的Session.info属性对scoped_session的支持。

  • [orm] [bug] Fixed bug where usage of new Bundle object would cause the Query.column_descriptions attribute to fail.

  • [orm] [bug] [sqlite] [sql] Fixed a regression introduced by the join rewriting feature of #2369 and #2587 where a nested join with one side already an aliased select would fail to translate the ON clause on the outside correctly; in the ORM this could be seen when using a SELECT statement as a “secondary” table.

    参考文献:#2858

orm declarative

  • [bug] [orm] [declarative] Declarative does an extra check to detect if the same Column is mapped multiple times under different properties (which typically should be a synonym() instead) or if two or more Column objects are given the same name, raising a warning if this condition is detected.

    参考文献:#2828

  • [bug] [orm] [declarative] 已经增强了DeferredReflection类,以便为relationship()“secondary”, when specified either as a string table name, or as a Table object with only a name and MetaData object will also be included in the reflection process when DeferredReflection.prepare() is called.

    参考文献:#2865

  • 修正了在Py2K中使用relationship()时,unicode文字不会被接受为声明式中类或其他参数的字符串名称的错误。[bug] [orm] [declarative] > ¶ T5>

发动机¶ T0>

  • [engine] [feature] The engine_from_config() function has been improved so that we will be able to parse dialect-specific arguments from string configuration dictionaries. 方言类现在可以提供自己的参数类型和字符串转换例程列表。但是,内置方言尚未使用该功能。

    参考文献:#2875

  • [engine] [bug] A DBAPI that raises an error on connect() which is not a subclass of dbapi.Error (such as TypeError, NotImplementedError, etc.) 将不会传播异常。以前,特定于connect()例程的错误处理将通过方言的Dialect.is_disconnect()例程错误地运行异常,并将其包装在sqlalchemy.exc.DBAPIError它现在以与执行过程中发生的相同的方式传播。

    这个改变也被backported修改为:0.8.4

    参考文献:#2881

  • [engine] [bug] [pool] The QueuePool has been enhanced to not block new connection attempts when an existing connection attempt is blocking. 以前,在监控溢出的块中,新连接的产生被串行化;溢出计数器现在在连接过程本身之外的其自己的临界区内被改变。

    这个改变也被backported修改为:0.8.4

    参考文献:#2880

  • [engine] [bug] [pool] Made a slight adjustment to the logic which waits for a pooled connection to be available, such that for a connection pool with no timeout specified, it will every half a second break out of the wait to check for the so-called “abort” flag, which allows the waiter to break out in case the whole connection pool was dumped; normally the waiter should break out due to a notify_all() but it’s possible this notify_all() is missed in very slim cases. 这是在0.8.0中首次引入的逻辑的扩展,这个问题偶尔会在压力测试中被观察到。

    这个改变也被backported修改为:0.8.4

    参考文献:#2522

  • [engine] [bug] Fixed bug where SQL statement would be improperly ASCII-encoded when a pre-DBAPI StatementError were raised within Connection.execute(), causing encoding errors for non-ASCII statements. 字符串化现在保留在Python unicode中,从而避免编码错误。

    这个改变也被backported修改为:0.8.4

    参考文献:#2871

  • [engine] [bug] The create_engine() routine and the related make_url() function no longer considers the + sign to be a space within the password field. 解析已经与RFC 1738完全匹配,因为usernamepassword只有:@ ,和/进行编码。

    参考文献:#2873

  • [engine] [bug] The RowProxy object is now sortable in Python as a regular tuple is; this is accomplished via ensuring tuple() conversion on both sides within the __eq__() method as well as the addition of a __lt__() method.

    参考文献:#2848

SQL ¶ T0>

  • [sql] [feature] New improvements to the text() construct, including more flexible ways to set up bound parameters and return types; in particular, a text() can now be turned into a full FROM-object, embeddable in other statements as an alias or CTE using the new method TextClause.columns(). 当构造体在“文字边界”上下文中编译时,text()结构也可以呈现“内联”边界参数。

    参考文献:#2882#2877

  • [sql] [feature] A new API for specifying the FOR UPDATE clause of a SELECT is added with the new GenerativeSelect.with_for_update() method. This method supports a more straightforward system of setting dialect-specific options compared to the for_update keyword argument of select(), and also includes support for the SQL standard FOR UPDATE OF clause. ORM还包含一个新的相应方法Query.with_for_update()请求提供Mario Lassnig提供的请求。

    也可以看看

    New FOR UPDATE support on select(), Query()上的新FOR UPDATE支持

    参考文献:请求github:42

  • [sql] [feature] 通过字符串将返回的浮点值强制转换为Python Decimal时使用的精度现在可配置。The flag decimal_return_scale is now supported by all Numeric and Float types, which will ensure this many digits are taken from the native floating point value when it is converted to string. 如果不存在,则该类型将使用.scale的值,如果类型支持此设置并且它不是None。否则,使用原始的默认长度10。

    参考文献:#2867

  • [sql] [bug] Fixed issue where a primary key column that has a Sequence on it, yet the column is not the “auto increment” column, either because it has a foreign key constraint or autoincrement=False set, would attempt to fire the Sequence on INSERT for backends that don’t support sequences, when presented with an INSERT missing the primary key value. 这将发生在像SQLite,MySQL这样的非序列后端上。

    这个改变也被backported修改为:0.8.5

    参考文献:#2896

  • [sql] [bug] Fixed bug with Insert.from_select() method where the order of the given names would not be taken into account when generating the INSERT statement, thus producing a mismatch versus the column names in the given SELECT statement. 还注意到Insert.from_select()意味着不能使用Python端插入默认值,因为该语句没有VALUES子句。

    这个改变也被backported修改为:0.8.5

    参考文献:#2895

  • [sql] [bug] The cast() function, when given a plain literal value, will now apply the given type to the given literal value on the bind parameter side according to the type given to the cast, in the same manner as that of the type_coerce() function. 然而,与type_coerce()不同,只有当非子句元素值传递给cast()时才会生效。一个现有的类型化构造将保留其类型。

  • ForeignKey类更积极地检查给定的列参数。[sql] [bug] 如果不是字符串,它会检查该对象是否至少是一个ColumnClause或解析为1的对象,并且.table属性(如果存在)指的是一个TableClause或子类,而不像Alias否则,会引发ArgumentError

    参考文献:#2883

  • [sql] [bug] ColumnOperators.collate()运算符的优先规则已被修改,因此COLLATE运算符的优先级低于比较运算符。这样做的结果是应用于比较的COLLATE不会在比较周围产生括号,而后者不会被MSSQL等后端解析。对于通过将Operators.collate()应用于比较表达式的单个元素而不是整个比较表达式来解决此问题的设置,此更改是向后兼容的。

    参考文献:#2879

  • [sql] [enhancement] The exception raised when a BindParameter is present in a compiled statement without a value now includes the key name of the bound parameter in the error message.

    这个改变也被backported修改为:0.8.5

架构¶ T0>

  • [schema] [bug] Fixed a regression caused by #2812 where the repr() for table and column names would fail if the name contained non-ascii characters.

    参考文献:#2868

的PostgreSQL ¶ T0>

  • [postgresql] [feature] 使用新的JSON类型添加了对Postgresql JSON的支持。非常感谢Nathan Rice实施和测试这个。

    参考文献:#2581请求github:50

  • [postgresql] [feature] 通过postgresql.TSVECTOR类型增加了对Postgresql TSVECTOR的支持。请求礼貌Noufal Ibrahim。

    参考:拉取请求bitbucket:8

  • [postgresql] [bug] Fixed bug where index reflection would mis-interpret indkey values when using the pypostgresql adapter, which returns these values as lists vs. psycopg2’s return type of string.

    这个改变也被backported修改为:0.8.4

    参考文献:#2855

  • [postgresql] [bug] 现在使用psycopg2 UNICODEARRAY扩展来处理带有psycopg2 +普通“native unicode”模式的unicode数组,这与UNICODE扩展的使用方式一样

  • [postgresql] [bug] 修正了ENUM中的值没有针对单引号转义的错误。请注意,这对于手动转义单引号的现有解决方法是向后不兼容的。

    参考文献:#2878

MySQL的¶ T0>

  • [mysql] [bug] 改进了SQL类型在__repr__()中生成的系统,特别是关于宽整型/数字/字符类型各种关键字参数。The __repr__() is important for use with Alembic autogenerate for when Python code is rendered in a migration script.

    参考文献:#2893

MSSQL ¶ T0>

  • [mssql] [bug] [firebird] The “asdecimal” flag used with the Float type will now work with Firebird as well as the mssql+pyodbc dialects; previously the decimal conversion was not occurring.

    这个改变也被backported修改为:0.8.5

  • [mssql] [bug] [pymssql] Added “Net-Lib error during Connection reset by peer” message to the list of messages checked for “disconnect” within the pymssql dialect. 礼貌John Anderson。

    这个改变也被backported修改为:0.8.5

    参考文献:请求github:51

  • [mssql] [bug] 修正了在0.8.0版本中引入索引的DROP INDEX如果索引处于备用模式中,MSSQL将不正确地渲染; schemaname / tablename将被颠倒。该格式也进行了修改以符合当前的MSSQL文档。Courtesy Derek Harland。

    这个改变也被backported修改为:0.8.4

    参考文献:pull request bitbucket:7

预言¶ T0>

  • [oracle] [bug] 增加了ORA-02396“最大空闲时间”的错误代码到cx_oracle的“is disconnect”代码列表。

    这个改变也被backported修改为:0.8.4

    参考文献:#2864

  • [oracle] [bug] Fixed bug where Oracle VARCHAR types given with no length (e.g. for a CAST or similar) would incorrectly render None CHAR or similar.

    这个改变也被backported修改为:0.8.4

    参考文献:#2870

火鸟¶ T0>

  • [firebird] [bug] 火鸟方言会引用以下划线开头的标识符。Courtesy Treeve Jelbert。

    这个改变也被backported修改为:0.8.5

    参考文献:#2897

  • [firebird] [bug] 修正了Firebird索引反射中索引内的列未正确排序的错误;现在它们按照RDB $ FIELD_POSITION的顺序排序。

    这个改变也被backported修改为:0.8.5

  • [firebird] [bug] Changed the queries used by Firebird to list table and view names to query from the rdb$relations view instead of the rdb$relation_fields and rdb$view_relations views. 新旧查询的变体在许多常见问题和博客中都有提及,但新的查询直接来自“Firebird常见问题解答”,它似乎是最正式的信息来源。

    参考文献:#2898

杂项¶ T0>

  • [removed] “informix”和“informixdb”方言已被删除;该代码现在可作为Bitbucket上的单独存储库提供。自从首次添加informixdb方言以来,IBM-DB项目已经提供了生产级别的Informix支持。

  • [bug] [declarative] 错误消息,当一个字符串arg发送到relationship(),它没有解析为类或映射器时,它的工作方式与当收到一个非字符串arg时,它表明有配置错误的关系的名字。

    这个改变也被backported修改为:0.8.5

    参考文献:#2888

  • [bug] [ext] Fixed bug which prevented the serializer extension from working correctly with table or column names that contain non-ASCII characters.

    这个改变也被backported修改为:0.8.4

    参考文献:#2869

  • [bug] [examples] 修正了阻止history_meta recipe使用超过一层深度的连接继承方案的错误。

0.9.0b1 ¶ T0>

发布日期:2013年10月26日

一般¶ T0>

  • [general] [feature] [py3k] 将C扩展移植到Python 3,并将在任何受支持的CPython 2或3环境下构建。

    参考文献:#2161

  • [general] [feature] [py3k] 现在,Python 2和3的代码库已经“就地”了,运行2to3的需求已被删除。兼容性现在在Python 2.6上正向运行。

    参考文献:#2671

  • [general] 对程序包的大量重构已重新组织了许多Core模块的导入结构以及ORM模块的某些方面。In particular sqlalchemy.sql has been broken out into several more modules than before so that the very large size of sqlalchemy.sql.expression is now pared down. 这项努力的重点是大量减少进口周期。Additionally, the system of API functions in sqlalchemy.sql.expression and sqlalchemy.orm has been reorganized to eliminate redundancy in documentation between the functions vs. the objects they produce.

ORM ¶ T0>

  • [orm] [feature] 添加了relationship() distinct_target_key的新选项。这使得子查询预热加载器策略能够将DISTINCT应用到最内层的SELECT子查询中,以协助处理与该关系相对应的最内层查询生成重复行的情况(目前还没有解决内部dupe行问题的一般解决方案但是,当加入最内层子查询之外的子查询会产生欺骗)。当标志被设置为True时,DISTINCT被无条件渲染,当它被设置为None时,如果最内层关系针对不包含完整的主键。该选项在0.8中默认为False(例如,在所有情况下默认关闭),0.9中的None(例如默认为自动)。感谢Alexander Koval为此提供帮助。

    This change is also backported to: 0.8.3

    参考文献:#2836

  • [orm] [feature] The association proxy now returns None when fetching a scalar attribute off of a scalar relationship, where the scalar relationship itself points to None, instead of raising an AttributeError.

    参考文献:#2810

  • [orm] [feature] 增加了新的方法AttributeState.load_history(),像AttributeState.history一样工作,但也触发加载器可调用。

    参考文献:#2787

  • [orm] [feature] 新增加载选项orm.load_only()这允许将一系列列名指定为仅“加载”那些属性,推迟其余的属性。

    参考文献:#1418

  • [orm] [feature] 加载器选项的系统已经完全重新架构,以构建更加全面的基础,即Load对象。这个基础允许任何常见的加载器选项,如joinedload()defer()等。以“链式”样式用于指定路径下的选项,如joinedload("foo").subqueryload("bar")新系统取代了点分隔路径名的使用,选项中的多个属性以及_all()选项的用法。

    参考文献:#1418

  • [orm] [feature] The composite() construct now maintains the return object when used in a column-oriented Query, rather than expanding out into individual columns. 这使得内部使用新的Bundle功能。这种行为是向后不相容的;要从将展开的组合列中进行选择,请使用MyClass.some_composite.clauses

    也可以看看

    Composite attributes are now returned as their object form when queried on a per-attribute basis查询时,复合属性现在以其对象形式返回

    参考文献:#2824

  • [orm] [feature] 添加了一个新的构造Bundle,它允许将列表达式组指定为一个Query构造。该列组默认情况下作为单个元组返回。可以重写Bundle的行为,以向返回的行提供任何类型的结果处理。当在面向列的Query中使用时,Bundle的行为现在也嵌入到复合属性中。

    参考文献:#2824

  • [orm] [feature] The version_id_generator parameter of Mapper can now be specified to rely upon server generated version identifiers, using triggers or other database-provided versioning features, or via an optional programmatic value, by setting version_id_generator=False. 当使用服务器生成的版本标识符时,ORM将在可用时使用RETURNING立即加载新版本值,否则它将发出第二个SELECT。

    参考文献:#2793

  • [orm] [feature] The eager_defaults flag of Mapper will now allow the newly generated default values to be fetched using an inline RETURNING clause, rather than a second SELECT statement, for backends that support RETURNING.

    参考文献:#2793

  • [orm] [feature] Session添加了一个新属性Session.info;这是一个字典,应用程序可以存储本地到Session的任意数据。The contents of Session.info can be also be initialized using the info argument of Session or sessionmaker.

  • [orm] [feature] 现在实现了删除事件侦听器。该功能通过event.remove()函数提供。

    也可以看看

    Event Removal API

    参考文献:#2268

  • [orm] [feature] 属性事件通过AttributeImpl作为“启动器”标记传递的机制已更改;该对象现在是一个名为attributes.Event的特定于事件的对象。此外,属性系统不再基于匹配的“启动器”令牌停止事件;这个逻辑已经被移动到特定于ORM backref事件处理程序,这是一个属性事件重新传播到随后的append / set / remove操作的典型源。如果方案不使用backref处理程序,那么模拟backrefs行为的最终用户代码现在必须确保递归事件传播方案被暂停。使用这个新系统,当一个对象被追加到一个集合上时,backref处理程序现在可以执行“双跳”操作,与一个新的多对一关联,与之前的多对一关联,然后从以前的集合中删除。在此更改之前,不会发生从上一个集合中删除的最后一步。

    参考文献:#2789

  • [orm] [feature] A major change regarding how the ORM constructs joins where the right side is itself a join or left outer join. The ORM is now configured to allow simple nesting of joins of the form a JOIN (b JOIN c ON b.id=c.id) ON a.id=b.id, rather than forcing the right side into a SELECT subquery. 这应该允许大多数后端显着提高性能,特别是MySQL。多年来一直存在这种变化的数据库后端SQLite现在通过将SELECT子查询的生成从ORM移动到SQL编译器来解决;所以SQLite上的右嵌套连接最终仍然会以SELECT呈现,而所有其他后端不再受此替代方法的影响。

    作为这种改变的一部分,已经在orm.aliased()Join.alias()中添加了一个新的参数flat=Trueorm.with_polymorphic()函数,该函数允许生成一个JOIN的“别名”,它将匿名别名应用于连接中的每个组件表,而不是生成子查询。

    参考文献:#2587

  • [orm] [bug] Fixed bug where using an annotation such as remote() or foreign() on a Column before association with a parent Table could produce issues related to the parent table not rendering within joins, due to the inherent copy operation performed by an annotation.

    This change is also backported to: 0.8.3

    参考文献:#2813

  • [orm] [bug] Fixed bug where Query.exists() failed to work correctly without any WHERE criterion. 礼貌弗拉基米尔Magamedov。

    This change is also backported to: 0.8.3

    参考文献:#2818

  • [orm] [bug] Fixed a potential issue in an ordered sequence implementation used by the ORM to iterate mapper hierarchies; under the Jython interpreter this implementation wasn’t ordered, even though cPython and Pypy maintained ordering.

    This change is also backported to: 0.8.3

    参考文献:#2794

  • [orm] [bug] Fixed bug in ORM-level event registration where the “raw” or “propagate” flags could potentially be mis-configured in some “unmapped base class” configurations.

    This change is also backported to: 0.8.3

    参考文献:#2786

  • [orm] [bug] 性能修正与加载映射实体时使用defer()选项有关。在加载时将每个对象的延迟可调用应用于实例的函数开销显着高于仅从该行加载数据的开销(请注意,defer()旨在减少DB /网络开销,不一定函数调用计数);在所有情况下,函数调用开销都小于从列中加载数据的开销。每个负载创建的“惰性可调用”对象的数量也从N(结果中的总延迟值)减少到1(延迟列的总数)。

    This change is also backported to: 0.8.3

    参考文献:#2778

  • [orm] [bug] Fixed bug whereby attribute history functions would fail when an object we moved from “persistent” to “pending” using the make_transient() function, for operations involving collection-based backrefs.

    This change is also backported to: 0.8.3

    参考文献:#2773

  • [orm] [bug] 尝试刷新继承类的对象时发出一个警告,其中多态鉴别符已被分配给该类无效的值¶ T2>

    这个改变也被backported修改为:0.8.2

    参考文献:#2750

  • [orm] [bug] Fixed bug in polymorphic SQL generation where multiple joined-inheritance entities against the same base class joined to each other as well would not track columns on the base table independently of each other if the string of joins were more than two entities long.

    这个改变也被backported修改为:0.8.2

    参考文献:#2759

  • [orm] [bug] Fixed bug where sending a composite attribute into Query.order_by() would produce a parenthesized expression not accepted by some databases.

    这个改变也被backported修改为:0.8.2

    参考文献:#2754

  • [orm] [bug] 修复了复合属性与aliased()函数之间的交互。以前,当应用别名时,组合属性在比较操作中无法正确工作。

    这个改变也被backported修改为:0.8.2

    参考文献:#2755

  • [orm] [bug] [ext] Fixed bug where MutableDict didn’t report a change event when clear() was called.

    这个改变也被backported修改为:0.8.2

    参考文献:#2730

  • [orm] [bug] Fixed bug where list instrumentation would fail to represent a setslice of [0:0] correctly, which in particular could occur when using insert(0, item) with the association proxy. 由于Python集合中的一些怪癖,使用Python 3而不是2的可能性更大。

    This change is also backported to: 0.8.3, 0.7.11

    参考文献:#2807

  • [orm] [bug] attributes.get_history() when used with a scalar column-mapped attribute will now honor the “passive” flag passed to it; as this defaults to PASSIVE_OFF, the function will by default query the database if the value is not present. 这是一个行为变化与0.8。

    参考文献:#2787

  • [orm] [bug] [associationproxy] Added additional criterion to the ==, != comparators, used with scalar values, for comparisons to None to also take into account the association record itself being non-present, in addition to the existing test for the scalar endpoint on the association record being NULL. Previously, comparing Cls.scalar == None would return records for which Cls.associated were present and Cls.associated.scalar is None, but not rows for which Cls.associated is non-present. More significantly, the inverse operation Cls.scalar != None would return Cls rows for which Cls.associated was non-present.

    Cls.scalar != 'somevalue'的情况也进行了修改,使其更像是直接的SQL比较;只有存在Cls.associated的行以及Associated.scalar不为NULL,并且不等于'somevalue'以前,这将是一个简单的NOT EXISTS

    Also added a special use case where you can call Cls.scalar.has() with no arguments, when Cls.scalar is a column-based value - this returns whether or not Cls.associated has any rows present, regardless of whether or not Cls.associated.scalar is NULL or not.

    参考文献:#2751

  • [orm] [bug] Fixed an obscure bug where the wrong results would be fetched when joining/joinedloading across a many-to-many relationship to a single-table-inheriting subclass with a specific discriminator value, due to “secondary” rows that would come back. 现在,“辅助”表和右侧表在内部加入了多对多关系的所有ORM连接的括号内,以便可以精确地过滤左右连接。最终通过#2587中概述的右嵌套连接解决了这个问题,从而实现了这一改变。

    参考文献:#2369

  • [orm] [bug] Query.select_from()方法的“自动别名”行为已被关闭。具体行为现在可以通过一个新方法Query.select_entity_from()获得。这里的自动别名行为从来没有很好的文档记录,并且通常不是我们所期望的,因为Query.select_from()已经变得更加倾向于控制JOIN的呈现方式。Query.select_entity_from()也将在0.8中可用,以便依赖于自动别名的应用程序可以将其应用程序移至使用此方法。

    参考文献:#2736

orm declarative

  • [feature] [orm] [declarative] 添加了一个便捷类装饰器as_declarative(),是declarative_base()基类用于使用漂亮的类装饰方法来应用。

    This change is also backported to: 0.8.3

  • [feature] [orm] [declarative] ORM descriptors such as hybrid properties can now be referenced by name in a string argument used with order_by, primaryjoin, or similar in relationship(), in addition to column-bound attributes.

    这个改变也被backported修改为:0.8.2

    参考文献:#2761

发动机¶ T0>

  • [engine] [feature] repr() for the URL of an Engine will now conceal the password using asterisks. Courtesy GunnlaugurÞórBriem。

    This change is also backported to: 0.8.3

    参考文献:#2821

  • [engine] [feature] 添加到ConnectionEvents的新事件:

    参考文献:#2770

  • [engine] [bug] [oracle] Dialect.initialize() is not called a second time if an Engine is recreated, due to a disconnect error. 这解决了Oracle 8方言中的一个特定问题,但通常dialect.initialize()阶段应该只能用于每种方言一次。

    This change is also backported to: 0.8.3

    参考文献:#2776

  • [engine] [bug] [pool] Fixed bug where QueuePool would lose the correct checked out count if an existing pooled connection failed to reconnect after an invalidate or recycle event.

    This change is also backported to: 0.8.3

    参考文献:#2772

  • [engine] [bug] Fixed bug where the reset_on_return argument to various Pool implementations would not be propagated when the pool was regenerated. Courtesy Eevee。

    这个改变也被backported修改为:0.8.2

    参考文献:请求github:6

  • [engine] [bug] The regexp used by the make_url() function now parses ipv6 addresses, e.g. surrounded by brackets.

    This change is also backported to: 0.8.3, 0.7.11

    参考文献:#2851

  • [engine] [bug] The method signature of Dialect.reflecttable(), which in all known cases is provided by DefaultDialect, has been tightened to expect include_columns and exclude_columns arguments without any kw option, reducing ambiguity - previously exclude_columns was missing.

    参考文献:#2748

SQL ¶ T0>

  • [sql] [feature] 通过Inspector.get_unique_constraints()方法增加了对“唯一约束”反射的支持。感谢Roman Podolyaka的补丁。

    这个改变也被backported修改为:0.8.4

    参考文献:#1443

  • [sql] [feature] The update(), insert(), and delete() constructs will now interpret ORM entities as target tables to be operated upon, e.g.:

    from sqlalchemy import insert, update, delete
    
    ins = insert(SomeMappedClass).values(x=5)
    
    del_ = delete(SomeMappedClass).where(SomeMappedClass.id == 5)
    
    upd = update(SomeMappedClass).where(SomeMappedClass.id == 5).values(name='ed')

    This change is also backported to: 0.8.3

  • [sql] [feature] [postgresql] [mysql] The Postgresql and MySQL dialects now support reflection/inspection of foreign key options, including ON UPDATE, ON DELETE. Postgresql也反映了MATCH,DEFERRABLE和INITIALLY。Coutesy ijl。

    参考文献:#2183

  • [sql] [feature] 现在,在类型化表达式中使用带有“null”类型(例如,没有指定类型)的bindparam()副本分配了比较列的实际类型。以前,这个逻辑会在给定的bindparam()上发生。Additionally, a similar process now occurs for bindparam() constructs passed to ValuesBase.values() for an Insert or Update construct, within the compilation phase of the construct.

    这些都是微妙的行为变化,可能会影响某些用途。

    参考文献:#2850

  • [sql] [feature] An overhaul of expression handling for special symbols particularly with conjunctions, e.g. None expression.null() expression.true() expression.false(), including consistency in rendering NULL in conjunctions, “short-circuiting” of and_() and or_() expressions which contain boolean constants, and rendering of boolean constants and expressions as compared to “1” or “0” for backends that don’t feature true/false constants.

    References: #2734, #2804, #2823

  • [sql] [feature] 打字系统现在处理渲染“文字束缚”值的任务,例如,值通常是绑定参数,但由于上下文必须呈现为字符串,通常位于DDL结构中,例如CHECK约束和索引(请注意,DDL从#2742使用“文字绑定”值) 。一个新的方法TypeEngine.literal_processor()作为基础,并且添加TypeDecorator.process_literal_param()以允许包装本地文字渲染方法。

    参考文献:#2838

  • [sql] [feature] The Table.tometadata() method now produces copies of all SchemaItem.info dictionaries from all SchemaItem objects within the structure including columns, constraints, foreign keys, etc. 由于这些字典是副本,因此它们与原始字典无关。在此之前,只有Column.info字典在此操作中传输,并且仅在适当的位置连接,而不是复制。

    参考文献:#2716

  • [sql] [feature] The default argument of Column now accepts a class or object method as an argument, in addition to a standalone function; will properly detect if the “context” argument is accepted or not.

  • [sql] [feature] insert()结构Insert.from_select()添加了新方法。Given a list of columns and a selectable, renders INSERT INTO (table) (columns) SELECT ... 虽然此功能在0.9中突出显示,但它也被反向移植到了0.8.3。

    也可以看看

    INSERT from SELECT

    参考文献:#722

  • [sql] [feature] TypeDecorator提供了一个名为TypeDecorator.coerce_to_is_types的新属性,以便更容易控制如何使用==!= to None和布尔类型用于生成IS表达式,参数。¶ T16>

    参考文献:#2734#2744

  • [sql] [feature] A label() construct will now render as its name alone in an ORDER BY clause, if that label is also referred to in the columns clause of the select, instead of rewriting the full expression. 这使数据库有更好的机会在两种不同的情况下优化相同表达式的评估。

    参考文献:#1068

  • [sql] [bug] Fixed bug where type_coerce() would not interpret ORM elements with a __clause_element__() method properly.

    This change is also backported to: 0.8.3

    参考文献:#2849

  • [sql] [bug] The Enum and Boolean types now bypass any custom (e.g. TypeDecorator) type in use when producing the CHECK constraint for the “non native” type. 这样自定义类型不会被包含在CHECK中的表达式中,因为这个表达式违背了“impl”值而不是“装饰”值。

    This change is also backported to: 0.8.3

    参考文献:#2842

  • [sql] [bug] The .unique flag on Index could be produced as None if it was generated from a Column that didn’t specify unique (where it defaults to None). 该标志现在总是TrueFalse

    This change is also backported to: 0.8.3

    参考文献:#2825

  • [sql] [bug] Fixed bug in default compiler plus those of postgresql, mysql, and mssql to ensure that any literal SQL expression values are rendered directly as literals, instead of as bound parameters, within a CREATE INDEX statement. 这也改变了其他DDL的渲染方案,如约束。

    This change is also backported to: 0.8.3

    参考文献:#2742

  • [sql] [bug] A select() that is made to refer to itself in its FROM clause, typically via in-place mutation, will raise an informative error message rather than causing a recursion overflow.

    This change is also backported to: 0.8.3

    参考文献:#2815

  • [sql] [bug] Fixed bug where using the column_reflect event to change the .key of the incoming Column would prevent primary key constraints, indexes, and foreign key constraints from being correctly reflected.

    This change is also backported to: 0.8.3

    参考文献:#2811

  • [sql] [bug] The ColumnOperators.notin_() operator added in 0.8 now properly produces the negation of the expression “IN” returns when used against an empty collection.

    This change is also backported to: 0.8.3

  • [sql] [bug] [postgresql] Fixed bug where the expression system relied upon the str() form of a some expressions when referring to the .c collection on a select() construct, but the str() form isn’t available since the element relies on dialect-specific compilation constructs, notably the __getitem__() operator as used with a Postgresql ARRAY element. 该修补程序还添加了一个新的异常类UnsupportedCompilationError,这是在编译器被要求编译一些不知道如何去做的情况下引发的。

    This change is also backported to: 0.8.3

    参考文献:#2780

  • [sql] [bug] 对于Select结构的相关行为的多个修复,在0.8.0中首次引入:

    • 为了满足这样的用例,其中FROM条目应该向外关联到一个包含另一个的SELECT,然后包含这个SELECT,当通过Select.correlate()建立显式相关性时,前提是目标选择位于WHERE / ORDER BY / columns子句所包含的链中,而不仅仅是嵌套的FROM子句。This makes Select.correlate() act more compatibly to that of 0.7 again while still maintaining the new “smart” correlation.
    • 当不使用显式关联时,通常的“隐式”关联将其行为限制为立即封闭的SELECT,以最大化与0.7应用程序的兼容性,并且还防止在这种情况下嵌套FROM之间的相关性,保持与0.8.0 / 0.8的兼容性。 1。
    • Select.correlate_except()方法在所有情况下都不会阻止给定的FROM子句相关,并且也会导致FROM子句完全被错误地省略(更像0.7会做的),这已经固定。
    • 调用select.correlate_except(None)将按照预期将所有FROM子句输入到相关中。

    这个改变也被backported修改为:0.8.2

    参考文献:#2668#2746

  • [sql] [bug] Fixed bug whereby joining a select() of a table “A” with multiple foreign key paths to a table “B”, to that table “B”, would fail to produce the “ambiguous join condition” error that would be reported if you join table “A” directly to “B”; it would instead produce a join condition with multiple criteria.

    这个改变也被backported修改为:0.8.2

    参考文献:#2738

  • [sql] [bug] [reflection] Fixed bug whereby using MetaData.reflect() across a remote schema as well as a local schema could produce wrong results in the case where both schemas had a table of the same name.

    这个改变也被backported修改为:0.8.2

    参考文献:#2728

  • [sql] [bug] 删除了来自基类ColumnOperators类的“未实现”__iter__()调用,而这是在0.8中引入的。 0,以防止在自定义运算符上实现__getitem__()方法,然后在该对象上错误地调用list()时出现无限的内存增长循环,导致列元素报告它们实际上是可迭代类型,当您尝试迭代时会抛出错误。没有真正的方式让双方都在这里,所以我们坚持使用Python的最佳实践。仔细在自定义运算符上实现__getitem__()

    这个改变也被backported修改为:0.8.2

    参考文献:#2726

  • [sql] [bug] 固定回归到0.7.9,如果CTE的名称在多个FROM子句中被引用,那么它的名称可能不会被正确引用。

    This change is also backported to: 0.8.3, 0.7.11

    参考文献:#2801

  • [sql] [bug] [cte] Fixed bug in common table expression system where if the CTE were used only as an alias() construct, it would not render using the WITH keyword.

    This change is also backported to: 0.8.3, 0.7.11

    参考文献:#2783

  • [sql] [bug] Fixed bug in CheckConstraint DDL where the “quote” flag from a Column object would not be propagated.

    This change is also backported to: 0.8.3, 0.7.11

    参考文献:#2784

  • [sql] [bug] 在调用“attach”事件之前,“name”属性在Index上设置,以便可以使用附件事件动态生成名称用于基于父表和/或列的索引。

    参考文献:#2835

  • [sql] [bug] 错误的kw arg“schema”已从ForeignKey对象中删除。这是一个无所作为的偶然犯罪;当使用这个kw arg时,在0.8.3中发出警告。

    参考文献:#2831

  • [sql] [bug] 对“引用”标识符的处理方式进行了重新修改,而不是依赖传递的各种quote=True标志,这些标志被转换为丰富的字符串对象,其中包含引用信息,这些信息被传递到通用模式结构(如TableColumn等)。这解决了各种方法的问题,这些方法没有正确地遵守“quote”标志,例如Engine.has_table()和相关方法。quoted_name对象是一个字符串子类,如果需要也可以明确使用;该对象将保持传递的引用偏好,并且还将绕过由大写符号标准化的方言(如Oracle,Firebird和DB2)执行的“名称规范化”。结果是,“大写”后端现在可以使用强制引用的名称,如小写引用的名称和新的保留字。

    参考文献:#2812

  • [sql] [bug] 根据时刻,将ForeignKey对象解析为其目标Column即目标ColumnForeignKey相同的MetaData关联,而不是等待第一次构建连接或类似。这与其他改进一起允许更早地检测一些外键配置问题。此处还包括类型传播系统的返工,因此现在应该可靠地将类型设置为None在任何Column上引用另一个ForeignKey - 一旦与其他列关联,该类型将从目标列中复制,现在也适用于组合外键。

    也可以看看

    Columns can reliably get their type from a column referred to via ForeignKey引用的列中获取它们的类型

    参考文献:#1765

的PostgreSQL ¶ T0>

  • [postgresql] [feature] 已添加对Postgresql 9.2范围类型的支持。目前,没有提供类型转换,因此目前可以直接使用字符串或psycopg2 2.5范围扩展类型。补丁礼貌Chris Withers。

    这个改变也被backported修改为:0.8.2

  • [postgresql] [feature] 在使用psycopg2 DBAPI时增加了对“AUTOCOMMIT”隔离的支持。该关键字可通过isolation_level执行选项使用。Pope礼貌Roman Podolyaka。

    这个改变也被backported修改为:0.8.2

    参考文献:#2072

  • [postgresql] [feature] Added support for rendering SMALLSERIAL when a SmallInteger type is used on a primary key autoincrement column, based on server version detection of Postgresql version 9.2 or greater.

    参考文献:#2840

  • [postgresql] [bug] 从列的服务器默认值的反射中删除了128个字符的截断;此代码原始来自PG系统视图,它为了可读性而截断了字符串。

    This change is also backported to: 0.8.3

    参考文献:#2844

  • [postgresql] [bug] 括号将应用于复合SQL表达式,并在CREATE INDEX语句的列表中呈现。

    This change is also backported to: 0.8.3

    参考文献:#2742

  • [postgresql] [bug] 修复了Postgresql版本字符串在前缀“Postgresql”或“EnterpriseDB”之前的前缀不会被解析的错误。Courtesy Scott Schaefer。

    This change is also backported to: 0.8.3

    参考文献:#2819

  • [postgresql] [bug] The behavior of extract() has been simplified on the Postgresql dialect to no longer inject a hardcoded ::timestamp or similar cast into the given expression, as this interfered with types such as timezone-aware datetimes, but also does not appear to be at all necessary with modern versions of psycopg2.

    这个改变也被backported修改为:0.8.2

    参考文献:#2740

  • [postgresql] [bug] Fixed bug in HSTORE type where keys/values that contained backslashed quotes would not be escaped correctly when using the “non native” (i.e. non-psycopg2) means of translating HSTORE data. 补丁由Ryan Kelly提供。

    这个改变也被backported修改为:0.8.2

    参考文献:#2766

  • [postgresql] [bug] 修复了多列Postgresql索引中的列顺序将以错误顺序反映的错误。Courtesy Roman Podolyaka。

    这个改变也被backported修改为:0.8.2

    参考文献:#2767

MySQL的¶ T0>

  • [mysql] [feature] The mysql_length parameter used with Index can now be passed as a dictionary of column names/lengths, for use with composite indexes. 非常感谢Roman Podolyaka提供的补丁。

    这个改变也被backported修改为:0.8.2

    参考文献:#2704

  • [mysql] [feature] 现在,MySQL mysql.SET类型具有与mysql.ENUM相同的自动引用行为。设置值时不需要引号,但是存在的引号将会随警告一起自动检测。这也有助于Alembic,其中SET类型不会用引号渲染。

    参考文献:#2817

  • [mysql] [bug] The change in #2721, which is that the deferrable keyword of ForeignKeyConstraint is silently ignored on the MySQL backend, will be reverted as of 0.9; this keyword will now render again, raising errors on MySQL as it is not understood - the same behavior will also apply to the initially keyword. 在0.8中,关键字将保持忽略,但会发出警告。此外,match关键字现在会在0.9上产生一个CompileError,并在0.8上发出警告;这个关键字不仅被MySQL默默地忽略,而且打破了ON UPDATE / ON DELETE选项。

    要使用在MySQL上不呈现或呈现不同的ForeignKeyConstraint,请使用自定义编译选项。这个用法的一个例子已经添加到文档中,请参阅MySQL Foreign Keys

    This change is also backported to: 0.8.3

    参考文献:#2721#2839

  • [mysql] [bug] MySQL-connector dialect now allows options in the create_engine query string to override those defaults set up in the connect, including “buffered” and “raise_on_warnings”.

    This change is also backported to: 0.8.3

    参考文献:#2515

  • [mysql] [bug] Fixed bug when using multi-table UPDATE where a supplemental table is a SELECT with its own bound parameters, where the positioning of the bound parameters would be reversed versus the statement itself when using MySQL’s special syntax.

    这个改变也被backported修改为:0.8.2

    参考文献:#2768

  • [mysql] [bug] mysql+gaerdbms方言添加了另一个条件,用于检测所谓的“开发”模式,我们应该使用rdbms_mysqldb补丁礼貌Brett Slatkin。

    这个改变也被backported修改为:0.8.2

    参考文献:#2715

  • [mysql] [bug] The deferrable keyword argument on ForeignKey and ForeignKeyConstraint will not render the DEFERRABLE keyword on the MySQL dialect. 很长一段时间,我们放弃了这一点,因为不可延迟的外键与延迟的外键的行为不同,但有些环境只是禁用MySQL上的FK,所以我们在这里不会引起注意。 t0 >

    这个改变也被backported修改为:0.8.2

    参考文献:#2721

  • [mysql] [bug] 版本5.5,5.6的MySQL保留字更新,Hanno Schlichting提供。

    This change is also backported to: 0.8.3, 0.7.11

    参考文献:#2791

  • [mysql] [bug] 修复并测试反射中的MySQL外键选项的解析;这补充了#2183中的工作,我们开始支持外键选项的反映,例如ON UPDATE / ON DELETE cascade。

    参考文献:#2839

  • [mysql] [bug] 改进了对cymysql驱动程序的支持,支持版本0.6.5,礼貌Hajime Nakagami。

源码¶ T0>

  • [sqlite] [bug] 新添加的SQLite DATETIME参数storage_format和regexp显然没有完全正确地实现;当论据被接受时,实际上它们将不起作用;这已被修复。

    This change is also backported to: 0.8.3

    参考文献:#2781

  • [sqlite] [bug] sqlalchemy.types.BIGINT添加到可以通过SQLite方言反映的类型名称列表;礼貌罗素斯图尔特。

    这个改变也被backported修改为:0.8.2

    参考文献:#2764

MSSQL ¶ T0>

  • 当在SQL Server 2000上查询信息模式时,删除了在0.8.1中添加的CAST调用,以帮助解决驱动程序问题,这在2000年显然不兼容。[mssql] [bug] CAST保持适用于SQL Server 2005及更高版本。

    这个改变也被backported修改为:0.8.2

    参考文献:#2747

  • [mssql] [bug] [pyodbc] 使用Python 3 + pyodbc修复MSSQL,包括正确传递语句

    参考文献:#2355

预言¶ T0>

  • [oracle] [feature] [py3k] 使用cx_oracle的Oracle单元测试现在可以在Python 3下完全传递。

  • [oracle] [bug] Fixed bug where Oracle table reflection using synonyms would fail if the synonym and the table were in different remote schemas. 补丁修复Kyle Derr礼貌。

    This change is also backported to: 0.8.3

    参考文献:#2853

火鸟¶ T0>

  • [firebird] [feature] 为kinterbasdb和fdb方言添加了新的标志retaining=True这将控制发送到DBAPI连接的commit()rollback()方法的retaining标志的值。由于历史原因,该标志在0.8.2中默认为True,但在0.9.0b1中,该标志默认为False

    这个改变也被backported修改为:0.8.2

    参考文献:#2763

  • [firebird] [feature] The fdb dialect is now the default dialect when specified without a dialect qualifier, i.e. firebird://, per the Firebird project publishing fdb as their official Python driver.

    参考文献:#2504

  • [firebird] [bug] Type lookup when reflecting the Firebird types LONG and INT64 has been fixed so that LONG is treated as INTEGER, INT64 treated as BIGINT, unless the type has a “precision” in which case it’s treated as NUMERIC. Patch courtesy Russell Stuart。

    这个改变也被backported修改为:0.8.2

    参考文献:#2757

杂项¶ T0>

  • [feature] system=True添加到Column中,将列标记为系统自动创建的列数据库(例如Postgresql oidxmin)。该列将从CREATE TABLE语句中省略,但否则可用于查询。另外,通过生成返回None的规则,可以将CreateColumn结构应用于允许跳过列的自定义编译规则。

    This change is also backported to: 0.8.3

  • [feature] [examples] 改进了examples/generic_associations中的示例,包括discriminator_on_association.py利用单个表继承进行工作“鉴别者”。还添加了一个真正的“通用外键”示例,该示例与其他流行框架的工作方式类似,因为它使用开放式整数指向任何其他表,前面提到了传统的参照完整性。虽然我们不推荐这种模式,但信息要免费。

    This change is also backported to: 0.8.3

  • [feature] [core] UpdateBase.returning()添加了一个名为ValuesBase.return_defaults()的新变体。这允许将任意列添加到语句的RETURNING子句中,而不会干扰编译器通常的“隐式返回”功能,该功能用于有效提取新生成的主键值。为支持后端,所有获取值的字典存在于ResultProxy.returned_defaults

    参考文献:#2793

  • [feature] [pool] 添加了“rollback-on-return”的池日志记录和较少使用的“commit-on-return”。这是使用其余池“调试”日志记录启用的。

    参考文献:#2752

  • [bug] [examples] 在版本控制示例中创建的历史记录表中添加了“autoincrement = False”,因为该表在任何情况下都不应该有autoinc,Patrick Schmid提供¶ T2>

    This change is also backported to: 0.8.3

  • [bug] [ext] Fixed bug whereby if a composite type were set up with a function instead of a class, the mutable extension would trip up when it tried to check that column for being a MutableComposite (which it isn’t). 礼貌asldevi。

    这个改变也被backported修改为:0.8.2

  • [bug] [examples] Fixed an issue with the “versioning” recipe whereby a many-to-one reference could produce a meaningless version for the target, even though it was not changed, when backrefs were present. 补丁由Matt Chisholm提供。

    这个改变也被backported修改为:0.8.2

  • [requirements] 现在需要Python mock库来运行单元测试套件。作为Python 3.3的标准库的一部分,以前的Python安装将需要安装它,以便运行单元测试或使用外部方言的sqlalchemy.testing包。 T2>

    这个改变也被backported修改为:0.8.2