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

SQLAlchemy 1.1文档

1.0更新日志

1.0.14 ¶ T0>

没有发布日期

发动机¶ T0>

SQL ¶ T0>

  • [sql] [bug] Fixed issue in SQL math negation operator where the type of the expression would no longer be the numeric type of the original. 这会导致类型确定结果集行为的问题。

    参考文献:#3735

  • [sql] [bug] Fixed bug whereby the __getstate__ / __setstate__ methods for sqlalchemy.util.Properties were non-working due to the transition in the 1.0 series to __slots__. 该问题可能会影响某些第三方应用程序。Pull请求Pieter Mulder提供。

    参考文献:#3728

  • [sql] [bug] FromClause.count()正在等待1.1弃用。该函数使用表中的任意列并且不可靠;对于核心用途,应该首选func.count()

    参考文献:#3724

  • [sql] [bug] Fixed bug in CTE structure which would cause it to not clone properly when a union was used, as is common in a recursive CTE. 当CTE用于各种ORM环境(如column_property())时,错误的克隆会导致错误。

    参考文献:#3722

  • [sql] [bug] Fixed bug whereby Table.tometadata() would make a duplicate UniqueConstraint for each Column object that featured the unique=True parameter.

    参考文献:#3721

杂项¶ T0>

  • [bug] [examples] 修复了examples / vertical / dictlike-polymorphic.py示例中发生的回退,该示例阻止其运行。

    参考文献:#3704

1.0.13 ¶ T0>

发布日期:2016年5月16日

ORM ¶ T0>

  • [orm] [bug] Fixed bug in “evaluate” strategy of Query.update() and Query.delete() which would fail to accommodate a bound parameter with a “callable” value, as which occurs when filtering by a many-to-one equality expression along a relationship.

    参考文献:#3700

  • [orm] [bug] Fixed bug whereby the event listeners used for backrefs could be inadvertently applied multiple times, when using a deep class inheritance hierarchy in conjunction with mutiple mapper configuration steps.

    参考文献:#3710

  • [orm] [bug] Fixed bug whereby passing a text() construct to the Query.group_by() method would raise an error, instead of intepreting the object as a SQL fragment.

    参考文献:#3706

  • [orm] [bug] Anonymous labeling is applied to a func construct that is passed to column_property(), so that if the same attribute is referred to as a column expression twice the names are de-duped, thus avoiding “ambiguous column” errors. 以前,需要应用.label(None)才能使名称匿名化。

    参考文献:#3663

  • [orm] [bug] Fixed regression appearing in the 1.0 series in ORM loading where the exception raised for an expected column missing would incorrectly be a NoneType error, rather than the expected NoSuchColumnError.

    参考文献:#3658

SQL ¶ T0>

  • [sql] [bug] Fixed bug where when using case_sensitive=False with an Engine, the result set would fail to correctly accomodate for duplicate column names in the result set, causing an error when the statement is executed in 1.0, and preventing the “ambiguous column” exception from functioning in 1.1.

    参考文献:#3690

  • [sql] [bug] Fixed bug where the negation of an EXISTS expression would not be properly typed as boolean in the result, and also would fail to be anonymously aliased in a SELECT list as is the case with a non-negated EXISTS construct.

    参考文献:#3682

  • [sql] [bug] Fixed bug where “unconsumed column names” exception would fail to be raised in the case where Insert.values() were called with a list of parameter mappings, instead of a single mapping of parameters. 拉请求Athena Yao提供。

    参考文献:#3666

的PostgreSQL ¶ T0>

  • [postgresql] [bug] 为错误字符串“SSL错误:解密失败或错误的记录mac”添加了断开连接检测支持。请求礼物Iuri de Silvio。

    参考文献:#3715

MSSQL ¶ T0>

  • [mssql] [bug] Fixed bug where by ROW_NUMBER OVER clause applied for OFFSET selects in SQL Server would inappropriately substitute a plain column from the local statement that overlaps with a label name used by the ORDER BY criteria of the statement.

    参考文献:#3711

  • [mssql] [bug] [oracle] Fixed regression appearing in the 1.0 series which would cause the Oracle and SQL Server dialects to incorrectly account for result set columns when these dialects would wrap a SELECT in a subquery in order to provide LIMIT/OFFSET behavior, and the original SELECT statement referred to the same column multiple times, such as a column and a label of that same column. This issue is related to #3658 in that when the error occurred, it would also cause a NoneType error, rather than reporting that it couldn’t locate a column.

    参考文献:#3657

预言¶ T0>

  • [oracle] [bug] 修复了cx_Oracle连接过程中的错误,当用户,密码或dsn为空时导致TypeError。这阻止了对Oracle数据库的外部认证,并阻止了连接到默认的dsn。连接字符串oracle://现在使用操作系统用户名登录到默认dsn,相当于使用'/'连接sqlplus。

    参考文献:#3705

  • [oracle] [bug] Fixed a bug in the result proxy used mainly by Oracle when binary and other LOB types are in play, such that when query / statement caching were used, the type-level result processors, notably that required by the binary type itself but also any other processor, would become lost after the first run of the statement due to it being removed from the cached result metadata.

    参考文献:#3699

杂项¶ T0>

  • [bug] [examples] 将“有向图”示例更改为不再将节点的整数标识符视为重要; “较高”/“较低”参考现在允许两个方向上的相互边缘。

    参考文献:#3698

  • [bug] [py3k] 修正了“to_list”转换中的错误,其中单个字节对象将变成单个字符列表。这将对使用字节对象的主键上的Query.get()方法产生影响。

    参考文献:#3660

1.0.12 ¶ T0>

发布日期:2016年2月15日

ORM ¶ T0>

  • [orm] [bug] Fixed bug in Session.merge() where an object with a composite primary key that has values for some but not all of the PK fields would emit a SELECT statement leaking the internal NEVER_SET symbol into the query, rather than detecting that this object does not have a searchable primary key and no SELECT should be emitted.

    参考文献:#3647

  • [orm] [bug] 从0.9版本开始修正了回归,0.9样式加载器选项系统在单个查询中无法适应多个undefer_group()加载器选项。现在即使对同一实体也会考虑多个undefer_group()选项。

    参考文献:#3623

发动机¶ T0>

  • [engine] [bug] [mysql] Revisiting #2696, first released in 1.0.10, which attempts to work around Python 2’s lack of exception context reporting by emitting a warning for an exception that was interrupted by a second exception when attempting to roll back the already-failed transaction; this issue continues to occur for MySQL backends in conjunction with a savepoint that gets unexpectedly lost, which then causes a “no such savepoint” error when the rollback is attempted, obscuring what the original condition was.

    这种方法已被推广到核心“安全重新评估”功能,该功能通过ORM和Core在任何发生尝试提交的错误时回滚事务的地方发生,包括由SessionConnection,并发生诸如“RELEASE SAVEPOINT”发生故障等操作。以前,修复只适用于ORM刷新/提交过程中的特定路径;它现在也适用于所有跨国上下文管理者。

    参考文献:#2696

SQL ¶ T0>

  • [sql] [bug] Fixed issue where the “literal_binds” flag was not propagated for expression.insert(), expression.update() or expression.delete() constructs when compiled to string SQL. 请求提供Tim Tate。

    参考文献:#3643请求github:232

  • [sql] [bug] Fixed issue where inadvertent use of the Python __contains__ override with a column expression (e.g. by using 'x' in col) would cause an endless loop in the case of an ARRAY type, as Python defers this to __getitem__ access which never raises for this type. 总的来说,所有使用__contains__现在引发NotImplementedError。

    参考文献:#3642

  • [sql] [bug] Fixed bug in Table metadata construct which appeared around the 0.9 series where adding columns to a Table that was unpickled would fail to correctly establish the Column within the ‘c’ collection, leading to issues in areas such as ORM configuration. 这可能会影响extend_existing等用例。

    参考文献:#3632

的PostgreSQL ¶ T0>

  • [postgresql] [bug] 修正了expression.text()结构中双冒号表达式无法正确转义的问题。 some\:\:expr,这是在呈现Postgresql样式的CAST表达式时最常用的。

    参考文献:#3644

MSSQL ¶ T0>

  • [mssql] [bug] Fixed the syntax of the extract() function when used on MSSQL against a datetime value; the quotes around the keyword are removed. 拉请求礼貌Guillaume Doumenc。

    参考文献:#3624拉取请求bitbucket:70

  • [mssql] [bug] [firebird] Fixed 1.0 regression where the eager fetch of cursor.rowcount was no longer called for an UPDATE or DELETE statement emitted via plain text or via the text() construct, affecting those drivers that erase cursor.rowcount once the cursor is closed such as SQL Server ODBC and Firebird drivers.

    参考文献:#3622

预言¶ T0>

  • [oracle] [bug] [jython] Fixed a small issue in the Jython Oracle compiler involving the rendering of “RETURNING” which allows this currently unsupported/untested dialect to work rudimentally with the 1.0 series. 请求卡洛斯里瓦斯请求。

    参考文献:#3621

杂项¶ T0>

  • [bug] [py3k] Fixed bug where some exception re-raise scenarios would attach the exception to itself as the “cause”; while the Python 3 interpreter is OK with this, it could cause endless loops in iPython.

    参考文献:#3625

1.0.11 ¶ T0>

发布日期:2015年12月22日

ORM ¶ T0>

  • [orm] [bug] 修正了1.0.10中由#3593修复引起的回归,其中为来自poly_subclass-> class-> poly_baseclass的多态连接加载添加了检查连接将失败的类 - > poly_subclass->类的情况。

    参考文献:#3611

  • [orm] [bug] Fixed bug where Session.bulk_update_mappings() and related would not bump a version id counter when in use. 这里的经验仍然有点粗糙,因为在给定字典中需要原始版本ID,并且还没有干净的错误报告。

    参考文献:#3610

  • [orm] [bug] Major fixes to the Mapper.eager_defaults flag, this flag would not be honored correctly in the case that multiple UPDATE statements were to be emitted, either as part of a flush or a bulk update operation. 此外,RETURNING将在更新语句中不必要地发出。

    参考文献:#3609

  • [orm] [bug] Fixed bug where use of the Query.select_from() method would cause a subsequent call to the Query.with_parent() method to fail.

    参考文献:#3606

SQL ¶ T0>

  • [sql] [bug] Fixed bug in Update.return_defaults() which would cause all insert-default holding columns not otherwise included in the SET clause (such as primary key cols) to get rendered into the RETURNING even though this is an UPDATE.

    参考文献:#3609

MySQL的¶ T0>

  • [mysql] [bug] 调整用于解析MySQL视图的正则表达式,以便我们不再假设反射视图源中存在“ALGORITHM”关键字,因为有些用户已经报告过在某些Amazon RDS环境中不存在。

    参考文献:#3613

  • [mysql] [bug] 为MySQL 5.7增加了MySQL保留字,包括'generated','optimizer_costs','stored','virtual'。请求礼貌Hanno Schlichting。

    参考文献:请求github:222

杂项¶ T0>

  • [bug] [ext] 进一步修正#3605MutableDict上的弹出方法,其中未包含“default”参数¶ T6>

    参考文献:#3605

  • [bug] [ext] Fixed bug in baked loader system where the systemwide monkeypatch for setting up baked lazy loaders would interfere with other loader strategies that rely on lazy loading as a fallback, e.g. joined and subquery eager loaders, leading to IndexError exceptions at mapper configuration time.

    参考文献:#3612

1.0.10 ¶ T0>

发布日期:2015年12月11日

ORM ¶ T0>

  • [orm] [bug] Fixed issue where post_update on a many-to-one relationship would fail to emit an UPDATE in the case where the attribute were set to None and not previously loaded.

    参考文献:#3599

  • [orm] [bug] 修正了错误,这实际上是由于#2714而在版本0.8.0和0.8.1之间发生的回归。当“with_polymorphic”也被使用时,加入的渴望加载需要连接到子类绑定关系的情况将无法从正确的实体中加入。

    参考文献:#3593

  • [orm] [bug] 修正了当a。该查询包含强制子查询b的限制/偏移量标准。该关系使用“次要”c。关系的主连接是指不是主键的一部分的列,或者是在与父表的主键列d不同的属性名下的连接继承子类表中的PK列。查询将延迟primaryjoin中存在的列,通常不会包含在load_only()中;子查询中不会出现必要的列并产生无效的SQL。

    参考文献:#3592

  • [orm] [bug] A rare case which occurs when a Session.rollback() fails in the scope of a Session.flush() operation that’s raising an exception, as has been observed in some MySQL SAVEPOINT cases, prevents the original database exception from being observed when it was emitted during flush, but only on Py2K because Py2K does not support exception chaining; on Py3K the originating exception is chained. 作为一种解决方法,在我们继续引发回滚起始异常之前,在这个特定情况下会发出警告,至少显示原始数据库错误的字符串消息。

    参考文献:#2696

orm declarative

  • [bug] [orm] [declarative] Fixed bug where in Py2K a unicode literal would not be accepted as the string name of a class or other argument within declarative using backref() on relationship(). 拉尔请求礼貌Nils Philippsen。

    参考文献:请求github:212

SQL ¶ T0>

  • [sql] [feature] 增加了对UPDATE语句中参数排序的SET子句的支持。通过将preserve_parameter_order标志传递给核心Update结构或者将其添加到Query.update.update_args字典ORM级别,还将参数本身作为2元组列表传递。感谢Gorka Eguileor进行实施和测试。

    参考文献:请求github:200

  • [sql] [bug] Fixed issue within the Insert.from_select() construct whereby the Select construct would have its ._raw_columns collection mutated in-place when compiling the Insert construct, when the target Table has Python-side defaults. 在编译Insert之后,Select结构将独立编译出现错误的列,并且Insert语句本身会在一秒钟后失败由于重复的绑定参数而导致的编译尝试。

    参考文献:#3603

  • [sql] [bug] [postgresql] Fixed bug where CREATE TABLE with a no-column table, but a constraint such as a CHECK constraint would render an erroneous comma in the definition; this scenario can occur such as with a Postgresql INHERITS table that has no columns of its own.

    参考文献:#3598

的PostgreSQL ¶ T0>

  • [postgresql] [bug] Fixed issue where the “FOR UPDATE OF” Postgresql-specific SELECT modifier would fail if the referred table had a schema qualifier; PG needs the schema name to be omitted. 拉请求礼貌戴安娜克拉克。

    参考文献:#3573请求github:216

  • [postgresql] [bug] Fixed bug where some varieties of SQL expression passed to the “where” clause of postgresql.ExcludeConstraint would fail to be accepted correctly. 拉请求礼貌aisch。

    参考文献:请求github:215

  • [postgresql] [bug] 修复了postgresql.INTERVAL.python_type属性以返回datetime.timedeltatypes.Interval.python_type相同,而不是引发NotImplementedError

    参考文献:#3571

MySQL的¶ T0>

  • [mysql] [bug] Fixed bug in MySQL reflection where the “fractional sections portion” of the mysql.DATETIME, mysql.TIMESTAMP and mysql.TIME types would be incorrectly placed into the timezone attribute, which is unused by MySQL, instead of the fsp attribute.

    参考文献:#3602

MSSQL ¶ T0>

  • [mssql] [bug] 将错误“20006:写入服务器失败”添加到pymssql驱动程序的断开连接错误列表中,因为已经发现这会导致连接不可用。¶ T2>

    参考文献:#3585

  • [mssql] [bug] 如果SQL服务器从DATE或TIME列中返回无效的日期或时间格式,而不是失败并返回一个NoneType错误,则会引发一个描述性的ValueError。请求礼貌Ed Avis。

    参考文献:请求github:206

  • [mssql] [bug] Fixed issue where DDL generated for the MSSQL types DATETIME2, TIME and DATETIMEOFFSET with a precision of “zero” would not generate the precision field. 请求礼貌Jacobo de Vera。

    参考文献:请求github:213

杂项¶ T0>

  • [bug] [ext] Added support for the dict.pop() and dict.popitem() methods to the mutable.MutableDict class.

    参考文献:#3605

  • [bug] [py3k] Updates to internal getargspec() calls, some py36-related fixture updates, and alterations to two iterators to “return” instead of raising StopIteration, to allow tests to pass without errors or warnings on Py3.5, Py3.6, pull requests courtesy Jacob MacDonald, Luri de Silvio, and Phil Jones.

    引用:请求github:210请求github:218请求github:211

  • [bug] [ext] Fixed an issue in baked queries where the .get() method, used either directly or within lazy loads, didn’t consider the mapper’s “get clause” as part of the cache key, causing bound parameter mismatches if the clause got re-generated. 该子句由mappers实时缓存,但在高度并发的情况下,第一次访问时可能会多次生成。

    参考文献:#3597

  • [tests] [change] ORM和Core教程始终处于doctest格式,现在在Python 2和Python 3的普通单元测试套件中运行。 T2>

1.0.9 ¶ T0>

发布日期:2015年10月20日

ORM ¶ T0>

  • [orm] [feature] 增加了新的方法Query.one_or_none();与Query.one()相同,但如果未找到任何行,则返回None。请求礼貌esiegerman。

    参考文献:请求github:201

  • [orm] [bug] [postgresql] Fixed regression in 1.0 where new feature of using “executemany” for UPDATE statements in the ORM (e.g. UPDATE statements are now batched with executemany() in a flush) would break on Postgresql and other RETURNING backends when using server-side version generation schemes, as the server side value is retrieved via RETURNING which is not supported with executemany.

    参考文献:#3556

  • [orm] [bug] Fixed rare TypeError which could occur when stringifying certain kinds of internal column loader options within internal logging.

    参考文献:#3539

  • [orm] [bug] Fixed bug in Session.bulk_save_objects() where a mapped column that had some kind of “fetch on update” value and was not locally present in the given object would cause an AttributeError within the operation.

    参考文献:#3525

  • [orm] [bug] Fixed 1.0 regression where the “noload” loader strategy would fail to function for a many-to-one relationship. 加载器使用API​​将“无”放入不再实际写入值的字典中;这是#3061的副作用

    参考文献:#3510

SQL ¶ T0>

  • [sql] [bug] Fixed regression in 1.0-released default-processor for multi-VALUES insert statement, #3288, where the column type for the default-holding column would not be propagated to the compiled statement in the case where the default was being used, leading to bind-level type handlers not being invoked.

    参考文献:#3520

的PostgreSQL ¶ T0>

  • [postgresql] [bug] 对1.0.6中发布的反映存储选项和使用#3455的新Postgresql功能进行调整,以禁用Postgresql版本的功能< 8.2未提供reloptions栏的地方;这允许Amazon Redshift再次运行,因为它基于PostgreSQL的8.0.x版本。修正Pete Hollobon提供的礼貌。

    参考文献:请求github:190

预言¶ 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,并且行无声无息地返回。

    这个改变也被backported改为:0.9.11

    参考文献:#3491

  • [oracle] [bug] Fixed bug in Oracle dialect where reflection of tables and other symbols with names quoted to force all-lower-case would not be identified properly in reflection queries. quoted_name结构现在应用于传入的符号名称,该名称在“name normalize”过程中检测为强制全部小写。

    参考文献:#3548

杂项¶ T0>

  • [feature] [ext] Added the AssociationProxy.info parameter to the AssociationProxy constructor, to suit the AssociationProxy.info accessor that was added in #2971. 这是可能的,因为AssociationProxy是显式构造的,与通过装饰器语法隐式构造的混合不同。

    参考文献:#3551

  • [bug] [examples] Fixed two issues in the “history_meta” example where history tracking could encounter empty history, and where a column keyed to an alternate attribute name would fail to track properly. 修正Alex Fraser的礼貌。

  • [bug] [sybase] Fixed two issues regarding Sybase reflection, allowing tables without primary keys to be reflected as well as ensured that a SQL statement involved in foreign key detection is pre-fetched up front to avoid driver issues upon nested queries. 在这里修复Eugene Zapolsky;请注意,我们目前无法测试Sybase以在本地验证这些更改。

    参考文献:#3508#3509

1.0.8 ¶ T0>

发布日期:2015年7月22日

发动机¶ 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字典仍然是前一个。

    这个改变也被backported改为:0.9.11

    参考文献:#3497

源码¶ 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.

    这个改变也被backported改为:0.9.10

    参考文献:#3495

杂项¶ T0>

  • [misc] [bug] 修复了utils中的特定基类没有实现__slots__的问题,因此意味着该类的所有子类都没有,否定__slots__的基本原理将被使用。除了IronPython之外没有任何问题,它显然没有实现兼容cPython的__slots__行为。

    参考文献:#3494

1.0.7 ¶ T0>

发布日期:2015年7月20日

ORM ¶ T0>

  • [orm] [bug] Fixed 1.0 regression where value objects that override __eq__() to return a non-boolean-capable object, such as some geoalchemy types as well as numpy types, were being tested for bool() during a unit of work update operation, where in 0.9 the return value of __eq__() was tested against “is True” to guard against this.

    参考文献:#3469

  • [orm] [bug] Fixed 1.0 regression where a “deferred” attribute would not populate correctly if it were loaded within the “optimized inheritance load”, which is a special SELECT emitted in the case of joined table inheritance used to populate expired or unloaded attributes against a joined table without loading the base table. 这与SQLA 1.0不再猜测加载延迟列的事实有关,必须明确指示。

    参考文献:#3468

  • [orm] [bug] Fixed 1.0 regression where the “parent entity” of a synonym- mapped attribute on top of an aliased() object would resolve to the original mapper, not the aliased() version of it, thereby causing problems for a Query that relies on this attribute (e.g. it’s the only representative attribute given in the constructor) to figure out the correct FROM clause for the query.

    参考文献:#3466

orm declarative

  • [bug] [orm] [declarative] 修正了AbstractConcreteBase扩展中的错误,其中ABC基础上具有不同属性名称与列名称的列设置不正确映射到最终的基类。0.9上的失败将是无声的,而在1.0上它会引发一个ArgumentError,所以在1.0之前可能没有被注意到。

    参考文献:#3480

发动机¶ T0>

  • [engine] [bug] Fixed regression where new methods on ResultProxy used by the ORM Query object (part of the performance enhancements of #3175) would not raise the “this result does not return rows” exception in the case where the driver (typically MySQL) fails to generate cursor.description correctly; an AttributeError against NoneType would be raised instead.

    参考文献:#3481

  • [engine] [bug] Fixed regression where ResultProxy.keys() would return un-adjusted internal symbol names for “anonymous” labels, which are the “foo_1” types of labels we see generated for SQL functions without labels and similar. 这是作为#918的一部分实现的性能增强的副作用。

    参考文献:#3483

SQL ¶ T0>

  • [sql] [feature] 添加了一个ColumnElement.cast()方法,它与独立的cast()函数具有相同的用途。请求Sebastian Bank提供。

    参考文献:#3459拉取请求bitbucket:56

  • [sql] [bug] Fixed bug where coersion of literal True or False constant in conjunction with and_() or or_() would fail with an AttributeError.

    参考文献:#3490

  • [sql] [bug] Fixed potential issue where a custom subclass of FunctionElement or other column element that incorrectly states ‘None’ or any other invalid object as the .type attribute will report this exception instead of recursion overflow.

    参考文献:#3485

  • [sql] [bug] Fixed bug where the modulus SQL operator wouldn’t work in reverse due to a missing __rmod__ method. 拉请求礼貌dan-gittik。

    参考文献:请求github:188

架构¶ T0>

  • [schema] [feature] 增加了Postgresql和Oracle支持的对CREATE SEQUENCE的MINVALUE,MAXVALUE,NO MINVALUE,NO MAXVALUE和CYCLE参数的支持。请求礼貌jakeogh。

    参考文献:请求github:186

1.0.6 ¶ T0>

发布日期:2015年6月25日

ORM ¶ T0>

  • [orm] [bug] Fixed a major regression in the 1.0 series where the version_id_counter feature would cause an object’s version counter to be incremented when there was no net change to the object’s row, but instead an object related to it via relationship (e.g. typically many-to-one) were associated or de-associated with it, resulting in an UPDATE statement that updates the object’s version counter and nothing else. 在使用相对较新的“服务器端”和/或“编程/条件”版本计数器功能的情况下(例如,将version_id_generator设置为False),该错误可能会导致发生无需发出有效SET子句的UPDATE ¶ T0>

    参考文献:#3465

  • [orm] [bug] Fixed 1.0 regression where the enhanced behavior of single-inheritance joins of #3222 takes place inappropriately for a JOIN along explicit join criteria with a single-inheritance subclass that does not make use of any discriminator, resulting in an additional “AND NULL” clause.

    参考文献:#3462

  • [orm] [bug] Fixed bug in new Session.bulk_update_mappings() feature where the primary key columns used in the WHERE clause to locate the row would also be included in the SET clause, setting their value to themselves unnecessarily. 请求帕特里克·海斯提出。

    参考文献:#3451请求github:181

  • [orm] [bug] Fixed an unexpected-use regression whereby custom Comparator objects that made use of the __clause_element__() method and returned an object that was an ORM-mapped InstrumentedAttribute and not explicitly a ColumnElement would fail to be correctly handled when passed as an expression to Session.query(). 0.9中的逻辑碰巧成功了,所以现在支持这个用例。

    参考文献:#3448

SQL ¶ T0>

  • [sql] [bug] Fixed a bug where clause adaption as applied to a Label object would fail to accommodate the labeled SQL expression in all cases, such that any SQL operation that made use of Label.self_group() would use the original unadapted expression. 这样做的一个影响是ORM aliased()结构不能完全容纳由column_property映射的属性,这样当属性出现时,无锯齿表可能会泄漏用于某些类型的SQL比较。

    参考文献:#3445

的PostgreSQL ¶ T0>

  • [postgresql] [feature] 使用新的关键字参数postgresql_with增加了对CREATE INDEX下存储参数的支持。还增加了对反射的支持,以支持postgresql_with标志以及postgresql_using标志,该标志现在将设置在反映的Index对象上,并在Inspector.get_indexes()的结果中出现在新的“dialect_options”字典中。拉请求Pete Hollobon提供。

    参考文献:#3455请求github:179

  • [postgresql] [feature] 增加了新的执行选项max_row_buffer,当使用stream_results选项时,psycopg2方言解释该选项,关于可能分配的行缓冲区的大小。该值也是基于发送给Query.yield_per()的整数值提供的。拉请求礼貌mcclurem。

    参考文献:请求github:182

  • [postgresql] [bug] [pypy] Re-fixed this issue first released in 1.0.5 to fix psycopg2cffi JSONB support once again, as they suddenly switched on unconditional decoding of JSONB types in version 2.7.1. 版本检测现在指定2.7.1作为我们应该期望DBAPI为我们执行json编码的地方。

    参考文献:#3439

  • [postgresql] [bug] 修复了ExcludeConstraint结构,以支持像Index等其他对象现在可以使用的常用功能,可以指定列表达式作为任意的SQL表达式,如casttext

    参考文献:#3454

MSSQL ¶ T0>

  • [mssql] [bug] 修正了将VARBINARY类型与INSERT的NULL + pyodbc结合使用的问题; pyodbc需要传递一个特殊对象才能保持NULL。As the VARBINARY type is now usually the default for LargeBinary due to #3039, this issue is partially a regression in 1.0. pymssql驱动程序似乎不受影响。

    参考文献:#3464

杂项¶ T0>

  • [bug] [documentation] Fixed an internal “memoization” routine for method types such that a Python descriptor is no longer used; repairs inspectability of these methods including support for Sphinx documentation.

    参考文献:#2077

1.0.5 ¶ T0>

发布日期:2015年6月7日

ORM ¶ T0>

  • [orm] [feature] Added new event InstanceEvents.refresh_flush(), invoked when an INSERT or UPDATE level default value fetched via RETURNING or Python-side default is invoked within the flush process. 这是为了提供一个不再作为#3167的结果存在的钩子,其中在flush过程中不再调用属性和验证事件。

    参考文献:#3427

  • [orm] [bug] The “lightweight named tuple” used when a Query returns rows failed to implement __slots__ correctly such that it still had a __dict__. 这已经解决了,但是在极不可能的情况下,有人正在为返回的元组赋值,这将不再有效。

    参考文献:#3420

发动机¶ T0>

  • [engine] [feature] 添加了新的引擎事件ConnectionEvents.engine_disposed()Engine.dispose()方法被调用后调用。

  • [engine] [feature] Adjustments to the engine plugin hook, such that the URL.get_dialect() method will continue to return the ultimate Dialect object when a dialect plugin is used, without the need for the caller to be aware of the Dialect.get_dialect_cls() method.

    参考文献:#3379

  • [engine] [bug] Fixed bug where known boolean values used by engine_from_config() were not being parsed correctly; these included pool_threadlocal and the psycopg2 argument use_native_unicode.

    参考文献:#3435

  • [engine] [bug] Added support for the case of the misbehaving DBAPI that has pep-249 exception names linked to exception classes of an entirely different name, preventing SQLAlchemy’s own exception wrapping from wrapping the error appropriately. The SQLAlchemy dialect in use needs to implement a new accessor DefaultDialect.dbapi_exception_translation_map to support this feature; this is implemented now for the py-postgresql dialect.

    参考文献:#3421

  • [engine] [bug] Fixed bug involving the case when pool checkout event handlers are used and connection attempts are made in the handler itself which fail, the owning connection record would not be freed until the stack trace of the connect error itself were freed. 对于仅使用单个连接的测试池的情况,这意味着该池将被完全检出,直到该堆栈跟踪被释放。这主要影响非常具体的调试场景,并且不可能在任何生产应用程序中显示出来。该修补程序在重新引发捕获的异常之前应用显式签入记录。

    参考文献:#3419

SQL ¶ T0>

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

    这个改变也被backported改为:0.9.10

    参考文献:#3418

的PostgreSQL ¶ T0>

  • [postgresql] [bug] [pypy] Repaired some typing and test issues related to the pypy psycopg2cffi dialect, in particular that the current 2.7.0 version does not have native support for the JSONB type. psycopg2功能的版本检测已被调整为psycopg2cffi的特定子版本。此外,psycopg2cffi下的全系列psycopg2功能已启用测试覆盖。

    参考文献:#3439

MSSQL ¶ T0>

  • [mssql] [bug] 为MSSQL方言legacy_schema_aliasing添加了一个新的方言标志,当设置为False时,将禁用一个非常陈旧和过时的行为,将所有模式限定的表名称转换为别名,以解决SQL Server无法在所有情况下解析多部分标识符名称的旧且不再可定位的问题。该行为阻止更复杂的语句正常工作,包括使用提示的语句以及嵌入相关SELECT语句的CRUD语句。而不是继续修复该功能以使用更复杂的语句,最好禁用它,因为任何现代SQL服务器版本都不再需要它。对于1.0.x系列,该标志默认为True,此版本系列的当前行为不变。在1.1系列中,它将默认为False。对于1.0系列,如果未明确设置任何值,则在语句中第一次使用模式限定表时会发出警告,这表明该标志对于所有现代SQL Server版本都设置为False。

    也可以看看

    Legacy Schema Mode

    参考文献:#3430#3424

杂项¶ T0>

  • [feature] [ext] Added support for *args to be passed to the baked query initial callable, in the same way that *args are supported for the BakedQuery.add_criteria() and BakedQuery.with_criteria() methods. 最初的PR礼节直接由田中直彦提供。

    参考:拉请求bitbucket:54

  • [feature] [ext] MutableBase MutableBase._get_listen_keys()添加了一个新的半公开方法。Overriding this method is needed in the case where a MutableBase subclass needs events to propagate for attribute keys other than the key to which the mutable type is associated with, when intercepting the InstanceEvents.refresh() or InstanceEvents.refresh_flush() events. 当前的例子是使用MutableComposite的合成。

    参考文献:#3427

  • [bug] [ext] Fixed regression in the sqlalchemy.ext.mutable extension as a result of the bugfix for #3167, where attribute and validation events are no longer called within the flush process. 如果列级别的Python端默认负责在INSERT或UPDATE上生成新值,或者在RETURNING子句中为“预设默认值”模式提取值,则可变扩展依赖于此行为。新值在人口稠密时不会受到任何事件的影响,并且可变延伸无法建立适当的强制或历史聆听。添加了一个新事件InstanceEvents.refresh_flush(),这个可变扩展现在用于这个用例。

    参考文献:#3427

1.0.4 ¶ T0>

发布日期:2015年5月7日

ORM ¶ T0>

  • [orm] [bug] Fixed unexpected-use regression where in the odd case that the primaryjoin of a relationship involved comparison to an unhashable type such as an HSTORE, lazy loads would fail due to a hash-oriented check on the statement parameters, modified in 1.0 as a result of #3061 to use hashing and modified in #3368 to occur in cases more common than “load on pending”. 现在先检查__hash__属性的值。

    参考文献:#3416

  • [orm] [bug] Liberalized an assertion that was added as part of #3347 to protect against unknown conditions when splicing inner joins together within joined eager loads with innerjoin=True; if some of the joins use a “secondary” table, the assertion needs to unwrap further joins in order to pass.

    参考文献:#3412#3347

  • [orm] [bug] 修复/添加到测试中的更多表达式被报告为失败,新的'实体'键值添加到Query.column_descriptions发现“from”子句再次被修改以容纳来自别名类的列,并且在这些情况下报告“别名”标志的正确值。

    参考文献:#3409#3320

架构¶ T0>

杂项¶ 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.

    这个改变也被backported改为:0.9.10

    参考文献:#3408

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

    这个改变也被backported改为:0.9.10

    参考文献:#3406

1.0.3 ¶ T0>

发布日期:2015年4月30日

ORM ¶ T0>

  • [orm] [bug] [pypy] Fixed regression from 0.9.10 prior to release due to #3349 where the check for query state on Query.update() or Query.delete() compared the empty tuple to itself using is, which fails on Pypy to produce True in this case; this would erronously emit a warning in 0.9 and raise an exception in 1.0.

    参考文献:#3405

  • [orm] [bug] 从发布之前0.9.10开始修正回归,其中entity新添加到Query.column_descriptions访问器将失败如果目标实体是从核心可选择的如TableCTE对象生成的。

    参考文献:#3320#3403

  • [orm] [bug] Fixed regression within the flush process when an attribute were set to a SQL expression for an UPDATE, and the SQL expression when compared to the previous value of the attribute would produce a SQL comparison other than == or !=, the exception “Boolean value of this clause is not defined” would raise. 该修复确保工作单元不会以这种方式解释SQL表达式。

    参考文献:#3402

  • [orm] [bug] Fixed unexpected use regression due to #2992 where textual elements placed into the Query.order_by() clause in conjunction with joined eager loading would be added to the columns clause of the inner query in such a way that they were assumed to be table-bound column names, in the case where the joined eager load needs to wrap the query in a subquery to accommodate for a limit/offset.

    最初,这里的行为是有意的,因为诸如query(User).order_by('name').limit(1)的查询将按照user.name即使查询是通过将加载的加载修改为子查询来修改的,因为'name'将被解释为位于FROM子句中的符号,在这种情况下User.name,然后将其复制到columns子句中以确保它存在于ORDER BY中。但是,该功能无法预测order_by("name")引用本地列子句中存在的特定标签名称的情况,而不是与FROM子句中的可选择名称绑定的名称。

    Beyond that, the feature also fails for deprecated cases such as order_by("name desc"), which, while it emits a warning that text() should be used here (note that the issue does not impact cases where text() is used explicitly), still produces a different query than previously where the “name desc” expression is copied into the columns clause inappropriately. 分辨率是这样的,当增加内部列子句时,特征的“加入的加载加载”方面将跳过这些所谓的“标签引用”表达式,就好像它们已经是text()结构。

    参考文献:#3392

  • [orm] [bug] Fixed a regression regarding the MapperEvents.instrument_class() event where its invocation was moved to be after the class manager’s instrumentation of the class, which is the opposite of what the documentation for the event explicitly states. The rationale for the switch was due to Declarative taking the step of setting up the full “instrumentation manager” for a class before it was mapped for the purpose of the new @declared_attr features described in Improvements to declarative mixins, @declared_attr and related features, but the change was also made against the classical use of mapper() for consistency. 但是,SQLSoup依赖于经典映射下的任何检测之前发生的检测事件。该行为在经典和声明式映射的情况下被恢复,后者通过使用简单的记忆而不使用类管理器来实现。

    参考文献:#3388

  • [orm] [bug] Fixed issue in new QueryEvents.before_compile() event where changes made to the Query object’s collection of entities to load within the event would render in the SQL, but would not be reflected during the loading process.

    参考文献:#3387

发动机¶ T0>

  • [engine] [feature] 添加了新功能以支持具有高级功能的引擎/池插件。在检出的连接包装以及_ConnectionRecord级别向连接池添加了一个新的“软无效”特性。这与现代游泳池失效类似,因为连接没有被主动关闭,但仅在下次结账时才被回收;这实质上是该功能的每个连接版本。添加一个新事件PoolEvents.soft_invalidate以补充它。

    还添加了新标志ExceptionContext.invalidate_pool_on_disconnect允许ConnectionEvents.handle_error()中的错误处理程序维护“断开连接”条件,但在事件中以特定方式处理对单个连接的无效调用。

    参考文献:#3379

  • [engine] [feature] Added new event DialectEvents.do_connect, which allows interception / replacement of when the Dialect.connect() hook is called to create a DBAPI connection. 还添加了方言插件钩子Dialect.get_dialect_cls()Dialect.engine_created(),允许外部插件使用入口点将事件添加到现有方言。 T6>

    参考文献:#3355

SQL ¶ T0>

  • [sql] [feature] 添加了一个占位符方法TypeEngine.compare_against_backend(),该方法现在由Alembic migrations从0.7.6开始使用。用户定义的类型可以实现此方法,以帮助比较数据库中反映的类型与类型。

  • [sql] [bug] Fixed bug where the truncation of long labels in SQL could produce a label that overlapped another label that is not truncated; this because the length threshhold for truncation was greater than the portion of the label that remains after truncation. 现在这两个数值已经相同; label_length - 6。这里的效果是,较短的列标签将被“截断”,之前它们不会被截断。

    参考文献:#3396

  • [sql] [bug] Fixed regression due to #3282 where the tables collection passed as a keyword argument to the DDLEvents.before_create(), DDLEvents.after_create(), DDLEvents.before_drop(), and DDLEvents.after_drop() events would no longer be a list of tables, but instead a list of tuples which contained a second entry with foreign keys to be added or dropped. 由于tables集合虽然被记录为不一定稳定,但依赖于此,这种变化被认为是一种回归。此外,在某些情况下,“收集”将会是一个迭代器,如果过早迭代,会导致操作失败。该集合现在是所有情况下的表对象列表,并且现在添加了用于此集合格式的测试覆盖。

    参考文献:#3391

杂项¶ T0>

  • [bug] [ext] Fixed bug in association proxy where an any()/has() on an relationship->scalar non-object attribute comparison would fail, e.g. filter(Parent.some_collection_to_attribute.any(Child.attr == 'foo'))

    参考文献:#3397

1.0.2 ¶ T0>

发布日期:2015年4月24日

orm declarative

  • [bug] [orm] [declarative] 修复了关于声明式__declare_first____declare_last__访问器的意外使用回归,声明性基类的超类。

    参考文献:#3383

SQL ¶ T0>

  • [sql] [bug] Fixed a regression that was incorrectly fixed in 1.0.0b4 (hence becoming two regressions); reports that SELECT statements would GROUP BY a label name and fail was misconstrued that certain backends such as SQL Server should not be emitting ORDER BY or GROUP BY on a simple label name at all; when in fact, we had forgotten that 0.9 was already emitting ORDER BY on a simple label name for all backends, as described in Label constructs can now render as their name alone in an ORDER BY, even though 1.0 includes a rewrite of this logic as part of #2992. 就针对简单标签发布GROUP BY而言,即使Postgresql也会引发错误,即使要标记的标签应该是显而易见的,所以显然GROUP BY不应该以这种方式自动呈现。

    在1.0.2中,SQL Server,Firebird和其他人在传递也存在于columns子句中的Label结构时,会再次在简单标签名称上发出ORDER BY。此外,仅当传递Label结构时,后端才会针对简单标签名称发出GROUP BY。

    参考文献:#3338#3385

1.0.1 ¶ T0>

发布日期:2015年4月23日

ORM ¶ T0>

  • [orm] [bug] Fixed issue where a query of the form query(B).filter(B.a != A(id=7)) would render the NEVER_SET symbol, when given a transient object. 对于持久对象,它总是使用持久数据库值而不是当前设置的值。假设autoflush已打开,通常这对于持久性值来说并不明显,因为在任何情况下都会首先刷新任何挂起的更改。然而,这与用于非否定比较的逻辑不一致,query(B).filter(Ba == A = 7)),它可以使用当前值,并且还可以与瞬态对象进行比较。现在比较使用当前值而不是数据库持久值。

    与本版本中由#3061引起的回归修复的其他NEVER_SET问题不同,这个特定问题的存在时间至少早于0.8且可能更早,但它被发现是因为修复了相关的NEVER_SET问题。

    参考文献:#3374

  • [orm] [bug] Fixed unexpected use regression cause by #3061 where the NEVER_SET symbol could leak into relationship-oriented queries, including filter() and with_parent() queries. 所有情况下都会返回None符号,但是,在任何情况下,这些查询中的许多都从未得到正确支持,并且在不使用IS运算符的情况下将其与NULL进行比较。因此,警告还会添加到当前不提供IS NULL的关系查询的子集中。

    参考文献:#3371

  • [orm] [bug] Fixed a regression caused by #3061 where the NEVER_SET symbol could leak into a lazyload query, subsequent to the flush of a pending object. 这通常会发生在不使用简单的“获取”策略的多对一关系中。好消息是修复程序的效率提高了0.9,因为我们现在可以在检测参数中存在的NEVER_SET符号时完全跳过SELECT语句;在#3061之前,我们无法辨别这里是否设置了None。

    参考文献:#3368

发动机¶ 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.

    这个改变也被backported改为:0.9.10

    参考文献:#3375

SQL ¶ T0>

  • [sql] [bug] Fixed issue where a straight SELECT EXISTS query would fail to assign the proper result type of Boolean to the result mapping, and instead would leak column types from within the query into the result map. 此问题也存在于0.9及更早版本中,但在这些版本中影响较小。在1.0中,由于#918,这成为一种回归,因为我们现在依赖于结果映射非常准确,否则我们可以将结果类型的处理器分配到错误的列。在所有版本中,这个问题也有一个效果,即一个简单的EXISTS不会应用布尔类型处理程序,导致后端的简单1/0值不使用本地布尔值而不是True / False。修复包括EXISTS列参数将像其他列表达式一样被匿名标记;对于纯布尔表达式(如not_(True()))实现了类似的修复。

    参考文献:#3372

源码¶ T0>

  • [sqlite] [bug] Fixed a regression due to #3282, where due to the fact that we attempt to assume the availability of ALTER when creating/dropping schemas, in the case of SQLite we simply said to not worry about foreign keys at all, since ALTER is not available, when creating and dropping tables. 这意味着在SQLite的情况下基本上跳过了表的排序,对于绝大多数的SQLite用例来说,这不是问题。

    然而,那些在SQLite上执行DROP并且带有数据并且参照完整性被打开的用户将会遇到错误,因为依赖关系排序在强制约束DROP的情况下很重要,当那些表有数据(只要没有数据被引用,SQLite仍然很乐意让你创建外键到不存在的表,并删除引用已有约束的现有表的表)。

    In order to maintain the new feature of #3282 while still allowing a SQLite DROP operation to maintain ordering, we now do the sort with full FKs taken under consideration, and if we encounter an unresolvable cycle, only then do we forego attempting to sort the tables; we instead emit a warning and go with the unsorted list. If an environment needs both ordered DROPs and has foreign key cycles, then the warning notes they will need to restore the use_alter flag to their ForeignKey and ForeignKeyConstraint objects so that just those objects will be omitted from the dependency sort.

    也可以看看

    The use_alter flag on ForeignKeyConstraint is (usually) no longer needed - 包含有关SQLite的更新注释。

    参考文献:#3378

火鸟¶ T0>

  • [firebird] [bug] 修正了由于#3034造成的回归,其中限制/偏移子句未被Firebird方言正确解释。请求礼貌effem-git。

    参考文献:#3380请求github:168

  • [firebird] [bug] Fixed support for “literal_binds” mode when using limit/offset with Firebird, so that the values are again rendered inline when this is selected. #3034相关

    参考文献:#3381

1.0.0 ¶ T0>

发布日期:2015年4月16日

ORM ¶ T0>

  • [orm] [feature] 添加了新的参数Query.update.update_args,它允许将诸如mysql_limit之类的kw参数传递给底层的Update结构。请求礼貌Amir Sadoughi。

    参考文献:请求github:164

  • [orm] [bug] 多次处理Query.join()到同一个目标时发现不一致;它仅在关系连接的情况下隐含地进行了重复数据删除,并且由于#3233,1.0中对同一个表的两次连接的行为与0.9不同,因为它不再是错误的别名。为了帮助记录这种变化,移植说明中关于#3233的措辞已经被推广,并且在针对相同的Query.join()调用时添加了警告目标关系不止一次。

    参考文献:#3367

  • [orm] [bug] Made a small improvement to the heuristics of relationship when determining remote side with semi-self-referential (e.g. two joined inh subclasses referring to each other), non-simple join conditions such that the parententity is taken into account and can reduce the need for using the remote() annotation; this can restore some cases that might have worked without the annotation prior to 0.9.4 via #2948.

    参考文献:#3364

SQL ¶ T0>

  • [sql] [feature] The topological sorting used to sort Table objects and available via the MetaData.sorted_tables collection will now produce a deterministic ordering; that is, the same ordering each time given a set of tables with particular names and dependencies. 这有助于比较DDL脚本和其他用例。这些表被发送到按名称排序的拓扑排序,并且拓扑排序本身将以有序方式处理输入数据。拉请求塞巴斯蒂安银行礼貌。

    References: #3084, pull request bitbucket:47

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

    这个改变也被backported改为:0.9.10

    参考文献:#3362

的PostgreSQL ¶ T0>

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

    这个改变也被backported改为:0.9.10

    参考文献:#3354

MSSQL ¶ T0>

  • [mssql] [bug] Fixed a regression where the “last inserted id” mechanics would fail to store the correct value for MSSQL on an INSERT where the primary key value was present in the insert params before execution, as well as in the case where an INSERT from SELECT would state the target columns as column objects, instead of string keys.

    参考文献:#3360

  • [mssql] [bug] 使用pymssql中现在存在的Binary构造函数,而不是修补其中的一个。请求拉米罗莫拉莱斯提供。

    参考文献:请求github:166

杂项¶ T0>

  • [bug] [tests] 修复测试运行时使用的路径;对于sqla_nose.py和py.test,“./lib”前缀再次插入到sys.path的头部,但前提是sys.flags.no_user_site未设置;这使得它的行为就像Python在默认情况下在当前路径中放置“。”一样。对于tox,我们现在设置PYTHONNOUSERSITE标志。

    参考文献:#3356

1.0.0b5 ¶ T0>

发布日期:2015年4月3日

ORM ¶ T0>

  • [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.

    这个改变也被backported改为:0.9.10

    参考文献:#3352

  • [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, an error is raised. 在0.9.10中,这只会发出警告。

    参考文献:#3349

  • [orm] [bug] Added a list() call around a weak dictionary used within the commit phase of the session, which without it could cause a “dictionary changed size during iter” error if garbage collection interacted within the process. 变更由#3139引入。

  • [orm] [bug] Fixed a bug related to “nested” inner join eager loading, which exists in 0.9 as well but is more of a regression in 1.0 due to #3008 which turns on “nested” by default, such that a joined eager load that travels across sibling paths from a common ancestor using innerjoin=True will correctly splice each “innerjoin” sibling into the appropriate part of the join, when a series of inner/outer joins are mixed together.

    参考文献:#3347

SQL ¶ T0>

  • [sql] [bug] The warning emitted by the unicode type for a non-unicode type has been liberalized to warn for values that aren’t even string values, such as integers; previously, the updated warning system of 1.0 made use of string formatting operations which would raise an internal TypeError. 尽管理想情况下这些情况应该完全提升,但像SQLite和MySQL这样的后端会接受它们,并且可能会被遗留代码使用,更不用说如果目标后端关闭unicode转换,它们将始终通过。 T0>

    参考文献:#3346

的PostgreSQL ¶ T0>

  • 修正了由于#3184引起的更新PG索引反射会导致索引操作在Postgresql 8.4及更早版本上失败的错误。[postgresql] [bug] 使用旧版Postgresql时,现在禁用了这些增强功能。

    参考文献:#3343

1.0.0b4 ¶ T0>

发布日期:2015年3月29日

SQL ¶ T0>

  • [sql] [bug] Fixed bug in new “label resolution” feature of #2992 where a label that was anonymous, then labeled again with a name, would fail to be locatable via a textual label. 如果在查询中为映射的column_property()赋予显式标签,则这种情况自然会发生。

    参考文献:#3340

  • [sql] [bug] Fixed bug in new “label resolution” feature of #2992 where the string label placed in the order_by() or group_by() of a statement would place higher priority on the name as found inside the FROM clause instead of a more locally available name inside the columns clause.

    参考文献:#3335

架构¶ T0>

MySQL的¶ T0>

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

    这个改变也被backported改为:0.9.10

    参考文献:#3337

MSSQL ¶ T0>

  • [mssql] [bug] [sybase] [firebird] [oracle] Turned off the “simple order by” flag on the MSSQL, Oracle dialects; this is the flag that per #2992 causes an order by or group by an expression that’s also in the columns clause to be copied by label, even if referenced as the expression object. MSSQL的行为现在是默认情况下复制整个表达式的旧行为,因为MSSQL对这些行为尤其在GROUP BY表达式中很挑剔。对于Firebird和Sybase方言,该标志在防御方面也被关闭。

    注意

    这个解决方案是不正确的,请参阅1.0.2版对这个决议的返工。

    参考文献:#3338

1.0.0b3 ¶ T0>

发布日期:2015年3月20日

MySQL的¶ T0>

  • [mysql] [bug] 修复了被无意中注释掉的问题#2771的提交。

    参考文献:#2771

1.0.0b2 ¶ T0>

发布日期:2015年3月20日

ORM ¶ T0>

  • [orm] [bug] Fixed unexpected use regression from pullreq github:137 where Py2K unicode literals (e.g. u"") would not be accepted by the relationship.cascade option. 请求礼貌Julien Castets。

    参考文献:#3327请求github:160

orm declarative

  • [orm] [declarative] [change] 松散了一些添加到@declared_attr对象的限制,以防止在声明过程之外调用它们;这与#3150的增强有关,它允许@declared_attr返回一个根据当前类配置缓存的值。异常引发已被删除,并且行为发生了变化,因此在声明过程之外,由@declared_attr装饰的函数每次都会像常规@property一样调用,没有使用任何缓存,因为在这个阶段没有任何缓存。

    参考文献:#3331

发动机¶ T0>

  • [engine] [bug] The “auto close” for ResultProxy is now a “soft” close. 也就是说,在使用提取方法排除所有行之后,DBAPI游标将像以前一样被释放,并且可以安全地丢弃该对象,但可能会继续调用获取方法,以便返回结果对象(无为fetchone,fetchmany和fetchall空列表)。只有明确调用ResultProxy.close()时,这些方法才会引发“result is closed”错误。

    参考文献:#3329#3330

MySQL的¶ T0>

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

    这个改变也被backported改为:0.9.10

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

  • [mysql] [bug] Fixes to fully support using the 'utf8mb4' MySQL-specific charset with MySQL dialects, in particular MySQL-Python and PyMySQL. 另外,报告诸如'koi8u'或'eucjpms'等更多不寻常字符集的MySQL数据库也能正常工作。拉格请求托马斯格兰杰提供

    参考文献:#2771拉取请求bitbucket:49

1.0.0b1 ¶ T0>

发布日期:2015年3月13日

版本1.0.0b1是1.0系列的第一个版本。这里描述的许多变化也存在于0.9和0.8系列中。对于特定于1.0的更改,强调兼容性问题,请参阅What’s New in SQLAlchemy 1.0?

一般¶ T0>

  • [general] [feature] 通过对许多内部对象使用__slots__,结构内存使用得到了改进。此优化尤其适用于具有大量表和列的大型应用程序的基本内存大小,并大大减少各种大容量对象(包括事件监听内部事件,比较对象以及ORM属性和加载器策略的某些部分)的内存大小系统。

  • [general] [bug] The __module__ attribute is now set for all those SQL and ORM functions that are derived as “public factory” symbols, which should assist with documentation tools being able to report on the target module.

    参考文献:#3218

ORM ¶ T0>

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

    这个改变也被backported改为:0.9.10

    参考文献:#3320

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

    也可以看看

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

    这个改变也被backported改为:0.9.9

    参考文献:#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超时,即使是回滚。

    这个改变也被backported改为:0.9.9

  • [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条件中使用的有效运算符列表中。

    这个改变也被backported改为:0.9.5

    参考文献:#3029

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

    这个改变也被backported改为:0.9.5

    参考文献:#3017

  • [orm] [feature] 新增了一个新的事件套件QueryEventsThe QueryEvents.before_compile() event allows the creation of functions which may place additional modifications to Query objects before the construction of the SELECT statement. 希望通过新的检查系统的出现使这一事件变得更加有用,这将允许以自动方式对Query对象进行详细的修改。

    也可以看看

    QueryEvents

    参考文献:#3317

  • [orm] [feature] 在使用联接的预加载时发生的子查询包装与一个一对多查询一起使用,该查询还具有LIMIT,OFFSET或DISTINCT在一个一对一关系,即relationship.uselist设置为False的一对多关系。这将在这些情况下产生更高效的查询。

    参考文献:#3249

  • [orm] [feature] 对映射状态内部进行了重新设计,以允许特定于对象“过期”的callcounts减少50%,如Session.commit()Session.expire_all(),以及在对象状态被垃圾收集时发生的“清除”步骤。

    参考文献:#3307

  • [orm] [feature] 将相同的多态标识分配给同一层次结构中的两个不同映射器时,会发出警告。这通常是用户错误,并且意味着在加载时不能正确区分这两种不同的映射类型。请求Sebastian Bank提供。

    参考文献:#3262拉取请求bitbucket:38

  • [orm] [feature] 已经创建了一系列新的Session方法,它们将工作单元直接提供给工作单元以发出INSERT和UPDATE语句。如果使用正确,这个面向专家的系统可以允许ORM映射用于生成批量插入和更新语句,批量插入到executemany组中,从而允许语句以与直接使用Core相媲美的速度进行。

    也可以看看

    Bulk Operations

    参考文献:#3100

  • [orm] [feature] 添加了与调用Query.outerjoin()同义的参数Query.join.isouter;与Core FromClause.join()相比,此标志提供更一致的接口。请求Jonathan Vanasco提供。

    参考文献:#3217

  • [orm] [feature] 添加了新的事件处理程序AttributeEvents.init_collection()AttributeEvents.dispose_collection()与实例相关联以及何时被替换。这些处理程序取代collection.linker()注释。旧挂钩仍然通过事件适配器支持。

  • [orm] [feature] The Query will raise an exception when Query.yield_per() is used with mappings or options where either subquery eager loading, or joined eager loading with collections, would take place. 这些加载策略目前与yield_per不兼容,所以通过提高这个错误,该方法更安全。可以使用lazyload('*')选项或Query.enable_eagerloads()来禁用预加载。

  • [orm] [feature] A new implementation for KeyedTuple used by the Query object offers dramatic speed improvements when fetching large numbers of column-oriented rows.

    参考文献:#3176

  • [orm] [feature] The behavior of joinedload.innerjoin as well as relationship.innerjoin is now to use “nested” inner joins, that is, right-nested, as the default behavior when an inner join joined eager load is chained to an outer join eager load.

    参考文献:#3008

  • [orm] [feature] UPDATE statements can now be batched within an ORM flush into more performant executemany() call, similarly to how INSERT statements can be batched; this will be invoked within flush to the degree that subsequent UPDATE statements for the same mapping and table involve the identical columns within the VALUES clause, that no SET-level SQL expressions are embedded, and that the versioning requirements for the mapping are compatible with the backend dialect’s ability to return a correct rowcount for an executemany operation.

  • [orm] [feature] The info parameter has been added to the constructor for SynonymProperty and ComparableProperty.

    参考文献:#2963

  • [orm] [feature] The InspectionAttr.info collection is now moved down to InspectionAttr, where in addition to being available on all MapperProperty objects, it is also now available on hybrid properties, association proxies, when accessed via Mapper.all_orm_descriptors.

    参考文献:#2971

  • [orm] [changed] The proc() callable passed to the create_row_processor() method of custom Bundle classes now accepts only a single “row” argument.

  • [orm] [changed] Deprecated event hooks removed: populate_instance, create_instance, translate_row, append_result

  • [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.

    这个改变也被backported改为:0.9.9

    参考文献:#3310

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

    这个改变也被backported改为:0.9.9

    参考文献:#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提出请求。

    这个改变也被backported改为:0.9.9

    参考文献:请求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. 这里确定替代的逻辑已被重新设计为更加开放。

    这个改变也被backported改为:0.9.9

    参考文献:#3300

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

    这个改变也被backported改为:0.9.9

    参考文献:#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化,并且在某些情况下会导致事务/锁的打开时间超过所需的时间。

    这个改变也被backported改为:0.9.9

    参考文献:#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. 当旧的关系被替换时发出警告,但是如果映射已经用于查询,旧的关系仍然会在一些注册表中被引用。

    这个改变也被backported改为:0.9.9

    参考文献:#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.

    这个改变也被backported改为:0.9.9

    参考文献:#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.

    这个改变也被backported改为:0.9.9

    参考文献:#3232

  • [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. 一些事件将无法注册,而其他事件不会正确地调用事件参数,通常是在事件被“包装”以便以其他方式进行适应的情况下。“命名”机制已重新排列,不会干扰内部包装函数期望的参数签名。

    这个改变也是backported改为:0.9.8

    参考文献:#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中发生。这一说法现在已经被纳入重复数据删除检查中,并带来更简单的方法来检查重复数据删除的额外好处。

    这个改变也是backported改为:0.9.8

    参考文献:#3199

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

    这个改变也是backported改为:0.9.8

    参考文献:#3194

  • [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.

    这个改变也被backported改为:0.9.7

    参考文献:#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.

    这个改变也被backported改为:0.9.7

    参考文献:#2736#3083

  • [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.

    这个改变也被backported改为:0.9.7

    参考文献:#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.

    这个改变也被backported改为:0.9.7

    参考文献:#3106

  • [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添加的现有支票的扩展。然而,这个新的检查仅发出警告,而不是例外,以允许可能依赖现有行为的应用程序。

    这个改变也被backported改为:0.9.5

    参考文献:#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.

    这个改变也被backported改为:0.9.5

    参考文献:#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版中。

    这个改变也被backported改为:0.9.5

    参考文献:#3060

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

    这个改变也被backported改为:0.9.5

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

    这个改变也被backported改为:0.9.5

    参考文献:#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.

    这个改变也被backported改为:0.9.5

    参考文献:#3013

  • [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.

    This change is also backported to: 0.9.5, 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. 对属性/键错误的捕获更具体,不包括配置步骤。

    This change is also backported to: 0.9.5, 0.8.7

    参考文献:#3047

  • [orm] [bug] Fixed bug where the session attachment error “object is already attached to session X” would fail to prevent the object from also being attached to the new session, in the case that execution continued after the error raise occurred.

    参考文献:#3301

  • [orm] [bug] The primary Mapper of a Query is now passed to the Session.get_bind() method when calling upon Query.count(), Query.update(), Query.delete(), as well as queries against mapped columns, column_property objects, and SQL functions and expressions derived from mapped columns. 这允许依赖于定制的Session.get_bind()方案或“绑定”元数据的会话在所有相关情况下都能够工作。

    References: #3242, #3227, #1326

  • [orm] [bug] The PropComparator.of_type() modifier has been improved in conjunction with loader directives such as joinedload() and contains_eager() such that if two PropComparator.of_type() modifiers of the same base type/path are encountered, they will be joined together into a single “polymorphic” entity, rather than replacing the entity of type A with the one of type B. E.g. a joinedload of A.b.of_type(BSub1)->BSub1.c combined with joinedload of A.b.of_type(BSub2)->BSub2.c will create a single joinedload of A.b.of_type((BSub1, BSub2)) -> BSub1.c, BSub2.c, without the need for the with_polymorphic to be explicit in the query.

    也可以看看

    Eager Loading of Specific or Polymorphic Subtypes - 包含说明新格式的更新示例。

    参考文献:#3256

  • [orm] [bug] Repaired support of the copy.deepcopy() call when used by the orm.util.CascadeOptions argument, which occurs if copy.deepcopy() is being used with relationship() (not an officially supported use case). 拉请求由duesenfranz提供。

    参考文献:请求github:137

  • [orm] [bug] Fixed bug where Session.expunge() would not fully detach the given object if the object had been subject to a delete operation that was flushed, but not committed. 这也会影响相关的操作,如make_transient()

    参考文献:#3139

  • [orm] [bug] A warning is emitted in the case of multiple relationships that ultimately will populate a foreign key column in conflict with another, where the relationships are attempting to copy values from different source columns. 这发生在具有重叠列的组合外键映射到每个引用不同引用列的关系的情况下。新的文档部分将说明该示例以及如何通过在每个关系的基础上专门指定“外来”列来解决该问题。

    参考文献:#3230

  • [orm] [bug] The Query.update() method will now convert string key names in the given dictionary of values into mapped attribute names against the mapped class being updated. 以前,字符串名称直接被采用并传递给核心更新语句,没有任何方法可以根据映射实体进行解析。支持同义词和混合属性作为Query.update()的主题属性。

    参考文献:#3228

  • [orm] [bug] Improvements to the mechanism used by Session to locate “binds” (e.g. engines to use), such engines can be associated with mixin classes, concrete subclasses, as well as a wider variety of table metadata such as joined inheritance tables.

    参考文献:#3035

  • [orm] [bug] Fixed bug in single table inheritance where a chain of joins that included the same single inh entity more than once (normally this should raise an error) could, in some cases depending on what was being joined “from”, implicitly alias the second case of the single inh entity, producing a query that “worked”. 但是,由于这种隐式别名并不适用于单表继承的情况,因此它并没有真正“充分发挥作用”,而且非常具有误导性,因为它并不总是显示出来。

    参考文献:#3233

  • [orm] [bug] The ON clause rendered when using Query.join(), Query.outerjoin(), or the standalone orm.join() / orm.outerjoin() functions to a single-inheritance subclass will now include the “single table criteria” in the ON clause even if the ON clause is otherwise hand-rolled; it is now added to the criteria using AND, the same way as if joining to a single-table target using relationship or similar.

    这是介于特征和缺陷之间的一种。

    参考文献:#3222

  • [orm] [bug] A major rework to the behavior of expression labels, most specifically when used with ColumnProperty constructs with custom SQL expressions and in conjunction with the “order by labels” logic first introduced in 0.9. 修复包括即使实体受到混淆,一个order_by(Entity.some_col_prop)现在可以使用“按标签排序”规则,可以通过继承呈现或通过使用aliased()结构;使用别名(例如,查询(Entity.some_prop, tt> entity_alias.some_prop))多次渲染同一列属性将标记每次出现实体具有不同的标签,并且另外“按标签排序”规则适用于两者(例如,order_by(Entity.some_prop, entity_alias.some_prop) t7 >)。其他问题可能会阻止“按标签排序”逻辑在0.9下工作,最值得注意的是标签的状态可能发生变化,使得“按标签排序”将停止工作,具体取决于调用方式,已得到修复。

    参考文献:#3148#3188

  • [orm] [bug] 更改了使用Query.from_self()时应用“单一继承标准”的方法或其普通用户Query.count()现在,在内部子查询中而不是外部子查询中指定了将行限制为具有某种类型的标准的条件,以便即使“列”子句中“类型”列不可用,我们也可以在“内部“查询。

    参考文献:#3177

  • [orm] [bug] 对延迟加载的机制做了一些小调整,这样在对象指向自身的非常罕见的情况下,干涉joinload()的可能性就会降低;在这种情况下,对象在加载其属性时会引用自身,这会导致加载器之间出现混淆。“对象指向自身”的用例并不完全支持,但修复还会消除一些开销,所以现在是测试的一部分。

    参考文献:#3145

  • [orm] [bug] “resurrect”ORM事件已被删除。这个事件钩子没有用处,因为在0.8中删除了旧的“可变属性”系统。

    参考文献:#3171

  • [orm] [bug] Fixed bug where attribute “set” events or columns with @validates would have events triggered within the flush process, when those columns were the targets of a “fetch and populate” operation, such as an autoincremented primary key, a Python side default, or a server-side default “eagerly” fetched via RETURNING.

    参考文献:#3167

  • [orm] [bug] [py3k] The IdentityMap exposed from Session.identity_map now returns lists for items() and values() in Py3K. 早期移植到Py3K这里有这些返回的迭代器,当它们在技术上应该是“可迭代的视图”时。现在,列表是可以的。

  • [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’; this now raises an exception, with a message to change the synchronize setting. 这是从0.9.7发出的警告升级而来的。

    参考文献:#3117

  • [orm] [change] 即使列中的某些列以某种方式存在于结果集中,标记为deferred的映射属性现在仍保持“延迟”状态。这是一种性能增强,因为当获得结果集时,ORM加载不再花费时间搜索每个延迟列。但是,对于依赖于此的应用程序,现在应该使用明确的undefer()或类似选项。

  • [orm] [enhancement] 调整属性的机制,涉及何时将值通过第一次访问隐式初始化为None;这种一直导致人口属性的行为不再这样做;将返回None值,但底层属性不会收到设置事件。这与集合的工作方式一致,并允许属性机制的行为更加一致;特别是,如果值实际设置为None,则获取不带值的属性不会压缩应继续执行的事件。

    根据编译时选项将绑定参数内联呈现为字符串。此功能的工作是由Dobes Vandermeer提供的。

    参考文献:#3061

orm declarative

发动机¶ T0>

  • [engine] [feature] 增加了用于查看事务隔离级别的新用户空间访问器; Connection.get_isolation_level()Connection.default_isolation_level

    这个改变也被backported改为:0.9.9

  • [engine] [feature] Added new event ConnectionEvents.handle_error(), a more fully featured and comprehensive replacement for ConnectionEvents.dbapi_error().

    这个改变也被backported改为:0.9.7

    参考文献:#3076

  • [engine] [feature] 可以发出一种新的警告样式,它将“过滤”出现N次参数化字符串。这允许可以引用参数的参数化警告被传递固定次数,直到允许Python警告过滤器压制它们,并且防止内存在Python的警告注册表中无限增长。

    参考文献:#3178

  • [engine] [bug] Fixed bug in Connection and pool where the Connection.invalidate() method, or an invalidation due to a database disconnect, would fail if the isolation_level parameter had been used with Connection.execution_options(); the “finalizer” that resets the isolation level would be called on the no longer opened connection.

    这个改变也被backported改为:0.9.9

    参考文献:#3302

  • [engine] [bug] A warning is emitted if the isolation_level parameter is used with Connection.execution_options() when a Transaction is in play; DBAPIs and/or SQLAlchemy dialects such as psycopg2, MySQLdb may implicitly rollback or commit the transaction, or not change the setting til next transaction, so this is never safe.

    这个改变也被backported改为:0.9.9

    参考文献:#3296

  • [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失败。

    这个改变也是backported改为:0.9.8

    参考文献:#3200

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

    这个改变也是backported改为:0.9.8

    参考文献:#3165

  • [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>

    这个改变也被backported改为:0.9.5

    参考文献:#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。

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

    这个改变也被backported改为:0.9.5

    参考文献:#3043

  • [engine] [bug] The engine-level error handling and wrapping routines will now take effect in all engine connection use cases, including when user-custom connect routines are used via the create_engine.creator parameter, as well as when the Connection encounters a connection error on revalidation.

    参考文献:#3266

  • [engine] [bug] 在事件正在自己运行的同时,从侦听器内部或并发线程中移除(或添加)事件侦听器,现在会引发RuntimeError,如所使用的集合现在是colletions.deque()的一个实例,并且在迭代时不支持更改。以前,使用普通的Python列表从事件本身中删除会产生沉默失败。

    参考文献:#3163

SQL ¶ T0>

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

    这个改变也被backported改为:0.9.5

    参考文献:#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字符串。

    这个改变也被backported改为:0.9.5

    参考文献:#2990

  • [sql] [feature] The SQL compiler now generates the mapping of expected columns such that they are matched to the received result set positionally, rather than by name. 最初,这被视为一种处理我们的列返回了难以预测的名称的案例,尽管在现代使用中这个问题已经被匿名标签克服。在这个版本中,该方法基本上通过几十次调用减少了每个结果的函数调用次数,对于更大的结果列集则更多。如果在编译的列集与接收到的列集之间存在任何差异,那么这种方法仍然会降级为现代版本的旧方法,因此,对于部分或全部文本编译方案而言,这些列表可能不一致时没有问题。¶ T0>

    参考文献:#918

  • [sql] [feature] 使用Column.server_default参数调用的DefaultClause中的文字值现在将使用“内联”编译器,以便它们按原样呈现,而不是作为绑定参数。

    参考文献:#3087

  • [sql] [feature] 传递给SQL表达式单元的对象不能被解释为SQL片段时,报告表达式的类型;请求礼貌Ryan P. Kelly。

    参考文献:请求github:150

  • [sql] [feature] Table.tometadata()方法添加了一个新参数Table.tometadata.nameTable.tometadata.schema类似,此参数会使新复制的Table采用新名称而不是现有名称。这增加了一个有趣的功能,即用一个新名称将Table对象复制到相同的 MetaData目标。拉提出请求n.d.帕克。¶ T0>

    参考文献:请求github:139

  • [sql] [feature] Exception messages have been spiffed up a bit. 如果为None,则不显示SQL语句和参数,从而减少与语句无关的错误消息的混淆。显示DBAPI级别异常的完整模块和类名,清楚地表明这是一个包装的DBAPI异常。语句和参数本身被限制在括号内的部分,以更好地将它们与错误消息和相互之间隔离。

    参考文献:#3172

  • [sql] [feature] Insert.from_select() now includes Python and SQL-expression defaults if otherwise unspecified; the limitation where non- server column defaults aren’t included in an INSERT FROM SELECT is now lifted and these expressions are rendered as constants into the SELECT statement.

  • [sql] [feature] 对于适用的数据库,UniqueConstraint构造现在包含在反映Table对象时。为了以足够的准确性达到这个目的,MySQL和Postgresql现在包含了在反映表,索引和约束时纠正索引重复和唯一约束的功能。In the case of MySQL, there is not actually a “unique constraint” concept independent of a “unique index”, so for this backend UniqueConstraint continues to remain non-present for a reflected Table. For Postgresql, the query used to detect indexes against pg_index has been improved to check for the same construct in pg_constraint, and the implicitly constructed unique index is not included with a reflected Table.

    In both cases, the Inspector.get_indexes() and the Inspector.get_unique_constraints() methods return both constructs individually, but include a new token duplicates_constraint in the case of Postgresql or duplicates_index in the case of MySQL to indicate when this condition is detected. 拉约请求Johannes Erdfelt提供。

    参考文献:#3184拉取请求bitbucket:30

  • [sql] [feature] Added new method Select.with_statement_hint() and ORM method Query.with_statement_hint() to support statement-level hints that are not specific to a table.

    参考文献:#3206

  • [sql] [feature] The info parameter has been added as a constructor argument to all schema constructs including MetaData, Index, ForeignKey, ForeignKeyConstraint, UniqueConstraint, PrimaryKeyConstraint, CheckConstraint.

    参考文献:#2963

  • [sql] [feature] The Table.autoload_with flag now implies that Table.autoload should be True. 请求Malik Diarra提供。

    参考文献:#3027

  • [sql] [feature] The Select.limit() and Select.offset() methods now accept any SQL expression, in addition to integer values, as arguments. 通常,这用于允许传递绑定参数,该参数可以稍后用值替换,从而允许SQL查询的Python端缓存。这里的实现完全向后兼容现有的第三方方言,但是那些实现特殊LIMIT / OFFSET系统的方言需要修改才能利用新的功能。限制和偏移也支持“literal_binds”模式,

    参考文献:#3034

  • [sql] [changed] The column() and table() constructs are now importable from the “from sqlalchemy” namespace, just like every other Core construct.

  • [sql] [changed] The implicit conversion of strings to text() constructs when passed to most builder methods of select() as well as Query now emits a warning with just the plain string sent. 然而,文本转换仍然正常进行。接受不带警告字符串的唯一方法是像“order_by()”,“group_by()”这样的“标签引用”方法。这些函数现在将在编译时尝试将单个字符串参数解析为可选择的列或标签表达式;如果没有找到,表达式仍会呈现,但您会再次收到警告。这里的基本原理是,从字符串到文本的隐式转换比现在更不可预期,并且最好是在传递原始字符串时向用户发送更多方向以指示应采取的方向。core_ORM教程已更新,以深入了解如何处理文本。

    参考文献:#2992

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

    这个改变也被backported改为:0.9.9

    参考文献: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.

    这个改变也被backported改为:0.9.9

    参考文献:#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.

    这个改变也被backported改为:0.9.9

    参考文献:#3248

  • [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__().

    这个改变也是backported改为:0.9.8

    参考文献:#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观察到的那样。

    这个改变也是backported改为:0.9.8

    参考文献:#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.

    这个改变也是backported改为:0.9.8

    参考文献:#3154

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

    这个改变也是backported改为:0.9.8

    参考文献:#3144#3067

  • [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编译时完成命名确定,而不是在约束/表构造时完成命令。

    这个改变也被backported改为:0.9.7

    参考文献:#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.

    这个改变也被backported改为:0.9.7

    参考文献:#3090

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

    这个改变也被backported改为:0.9.7

    参考文献:#3069

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

    这个改变也被backported改为:0.9.7

    参考文献:#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.

    这个改变也被backported改为:0.9.7

    参考文献:#3122

  • [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>

    这个改变也被backported改为:0.9.5

    参考文献:#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.

    这个改变也被backported改为:0.9.5

    参考文献:#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.

    这个改变也被backported改为:0.9.5

    参考文献:#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.

    这个改变也被backported改为:0.9.5

    参考文献:#1068#3020

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

    这个改变也被backported改为:0.9.5

  • [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.

    This change is also backported to: 0.9.7, 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.

    This change is also backported to: 0.9.7, 0.8.7

    参考文献:#3102

  • [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.

    This change is also backported to: 0.9.5, 0.8.7

    参考文献:#3044

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

    This change is also backported to: 0.9.5, 0.8.7

    参考文献:#3045

  • [sql] [bug] The multi-values version of Insert.values() has been repaired to work more usefully with tables that have Python- side default values and/or functions, as well as server-side defaults. 该功能现在可以使用使用“位置”参数的方言;就像“executemany”样式调用一样,每个行也会单独调用一个Python可调用对象;服务器端默认列将不再隐式地接收为第一行显式指定的值,而拒绝在没有显式值的情况下调用。

    也可以看看

    Python-side defaults invoked for each row invidually when using a multivalued insert时,为每行独立调用Python端缺省值

    参考文献:#3288

  • [sql] [bug] Fixed bug in Table.tometadata() method where the CheckConstraint associated with a Boolean or Enum type object would be doubled in the target table. 复制过程现在将该约束对象的生产追踪为类型对象的本地对象。

    参考文献:#3260

  • [sql] [bug] ForeignKeyConstraint.columns集合的行为契约已经一致;这个属性现在是一个类似所有其他约束的ColumnCollection,并且在约束与Table关联的时候初始化。

    参考文献:#3243

  • [sql] [bug] The Column.key attribute is now used as the source of anonymous bound parameter names within expressions, to match the existing use of this value as the key when rendered in an INSERT or UPDATE statement. 这允许将Column.key用作“替代”字符串来解决难以转换为绑定参数名称的困难列名称。请注意,在任何情况下,paramstyle都可以在create_engine()上配置,并且今天大多数DBAPI支持命名和位置样式。

    参考文献:#3245

  • [sql] [bug] 修复传递给此事件的PoolEvents.reset.dbapi_connection参数的名称;特别是这会影响该事件的“命名”参数风格的使用。拉金请求提供Jason Goldberger。

    参考文献:请求github:146

  • [sql] [bug] Reversing a change that was made in 0.9, the “singleton” nature of the “constants” null(), true(), and false() has been reverted. 这些返回“单例”对象的函数具有这样的效果,即不管词典使用如何,不同的实例都将被视为相同,这尤其会影响SELECT语句的columns子句的呈现。

    参考文献:#3170

  • [sql] [bug] [engine] 修复了当您调用Connection.connect()时获得的“分支”连接不会共享的错误与父母的无效状态。分支体系结构已经调整了一点,以便分支连接按照所有失效状态和操作顺从父项。

    参考文献:#3215

  • [sql] [bug] [engine] 修复了当您调用Connection.connect()时获得的“分支”连接不会共享的错误与父母的交易状态。分支体系结构已经做了一些调整,以便分支连接按照所有事务状态和操作顺从父进程。

    参考文献:#3190

  • [sql] [bug] Using Insert.from_select() now implies inline=True on insert(). 这有助于修复INSERT ... FROM SELECT构造无意中编译为支持后端的“隐式返回”的错误,这会在插入零行的INSERT情况下导致破坏(因为隐式返回期望行) ,以及在插入多行的INSERT情况下的任意返回数据(例如,只有很多行的第一行)。一个类似的更改也适用于具有多个参数集的INSERT..VALUES;隐含的RETURNING将不再为此语句发出。由于这两个构造都处理可变数量的行,所以ResultProxy.inserted_primary_key访问器不适用。以前,有一个文档说明,有人可能更喜欢带有INSERT..FROM SELECT的inline=True,因为有些数据库不支持返回,因此不能做“隐式”返回,但没有任何理由INSERT ... FROM SELECT需要在任何情况下隐式返回。如果需要插入数据,则应使用常规显式Insert.returning()来返回可变数目的结果行。

    参考文献:#3169

  • [sql] [enhancement] Custom dialects that implement GenericTypeCompiler can now be constructed such that the visit methods receive an indication of the owning expression object, if any. 任何接受关键字参数的访问方法(例如**kw)在大多数情况下都会接收关键字参数type_expression,并引用该类型所包含的表达式对象。对于DDL中的列,方言的编译器类可能需要修改它的get_column_specification()方法以支持它。如果在参数签名中提供**kwUserDefinedType.get_col_spec()方法也会接收type_expression >

    参考文献:#3074

架构¶ T0>

的PostgreSQL ¶ T0>

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

    这个改变也被backported改为:0.9.9

    参考:拉请求bitbucket:45

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

    这个改变也是backported改为:0.9.8

    参考文献:请求github:125

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

    这个改变也被backported改为:0.9.7

    References: #3078, pull request bitbucket:22

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

    这个改变也被backported改为:0.9.7

    参考文献:请求github:101

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

    这个改变也被backported改为:0.9.5

    参考文献:请求github:88

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

    这个改变也被backported改为:0.9.5

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

  • [postgresql] [feature] PG8000方言现在支持create_engine.encoding参数,方法是在连接上设置客户端编码,然后由pg8000拦截。拉托洛克洛请求礼貌。

    参考:请求github:132

  • [postgresql] [feature] 增加了对PG8000原生JSONB功能的支持。拉托洛克洛请求礼貌。

    参考:请求github:132

  • [postgresql] [feature] [pypy] 增加了对pypy上psycopg2cffi DBAPI的支持。拉请求礼貌shauns。

    References: #3052, pull request bitbucket:34

  • [postgresql] [feature] 增加了对应用于聚合函数的FILTER关键字的支持,Postgresql 9.4支持该关键字。拉尔请求IljaEverilä礼貌。

    参考文献:请求github:134

  • [postgresql] [feature] 已经添加了对物化视图和外部表的反映,以及对Inspector.get_view_names()中物化视图的支持以及新方法PGInspector.get_foreign_table_names()在Postgresql版本的Inspector上可用。Pull请求Rodrigo Menezes礼貌。

    参考文献:#2891请求github:128

  • [postgresql] [feature] 通过Table构造渲染DDL时,增加了对PG表选项TABLESPACE,ON COMMIT,WITH(OUT)OIDS和INHERITS的支持。拉请求礼貌malikdiarra。

    参考文献:#2051

  • 当使用Postgresql的检查器时,添加新方法PGInspector.get_enums()将提供ENUM类型的列表。[postgresql] [feature] 请求礼物Ilya Pekelny。

    参考:请求github:126

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

    这个改变也被backported改为:0.9.9

    参考文献:#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提供。

    这个改变也被backported改为:0.9.9

    参考文献:请求github:145

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

    这个改变也被backported改为:0.9.9

  • [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.

    这个改变也被backported改为:0.9.9

    参考文献:#3174

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

    这个改变也是backported改为:0.9.8

    参考文献:#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的空值。

    这个改变也是backported改为:0.9.8

    参考文献:#3159

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

    这个改变也是backported改为:0.9.8

    参考文献:#3075

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

    这个改变也是backported改为:0.9.8

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

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

    这个改变也是backported改为:0.9.8

    参考文献:#3137

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

    这个改变也被backported改为:0.9.7

    参考文献:#3134

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

    这个改变也被backported改为:0.9.5

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

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

    This change is also backported to: 0.9.5, 0.8.7

    参考文献:#3053

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

    This change is also backported to: 0.9.5, 0.8.7

    参考:拉取请求bitbucket:13

  • [postgresql] [bug] The Postgresql postgresql.ENUM type will emit a DROP TYPE instruction when a plain table.drop() is called, assuming the object is not associated directly with a MetaData object. 为了适应多个表之间共享枚举类型的用例,类型应该直接与MetaData对象关联;在这种情况下,类型只能在元数据级别创建,或者直接创建。一般来说,Postgresql枚举类型的创建/删除规则已被高度重构。

    参考文献:#3319

  • [postgresql] [bug] The PGDialect.has_table() method will now query against pg_catalog.pg_table_is_visible(c.oid), rather than testing for an exact schema match, when the schema name is None; this so that the method will also illustrate that temporary tables are present. 请注意,这是一个行为改变,因为Postgresql允许非临时表以默默方式覆盖现有的具有相同名称的临时表,所以这改变了checkfirst在该异常情况下的行为。

    参考文献:#3264

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

    这个改变也被backported改为:0.9.5

    参考文献:#3002

MySQL的¶ T0>

  • [mysql] [feature] 现在,MySQL方言在所有情况下都使用NULL / NOT NULL呈现TIMESTAMP,因此启用explicit_defaults_for_timestamp标志的MySQL 5.6.6将允许TIMESTAMP在nullable=False时继续按预期工作。现有的应用程序不受影响,因为SQLAlchemy总是为nullable=True的TIMESTAMP列发出NULL。

    参考文献:#3155

  • [mysql] [feature] 在Python 2下将MySQLdb和Pymysql的“supports_unicode_statements”标志更新为True。这是指SQL语句本身,而不是参数,并影响使用非ASCII字符的表和列名称等问题。这些驱动程序似乎都支持Python 2 Unicode对象,而在现代版本中没有问题。

    参考文献:#3121

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

    这个改变也被backported改为:0.9.9

    参考文献:#3274

  • [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版。

    这个改变也是backported改为:0.9.8

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

    这个改变也是backported改为:0.9.8

  • [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.

    This change is also backported to: 0.9.7, 0.8.7

    参考文献:#3101

  • [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. 该修复使得引号是可选的,但也提供了旧的行为,以便与使用变通方法的向后兼容。

    This change is also backported to: 0.9.5, 0.8.7

    参考文献:#3085

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

    This change is also backported to: 0.9.5, 0.8.7

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

  • [mysql] [bug] 现在,MySQL方言支持将CAST构造为TypeDecorator对象。

  • [mysql] [bug] 在MySQL不支持CAST的类型上使用cast()时,会发出警告。 MySQL仅支持一部分数据类型的CAST。SQLAlchemy很长一段时间在MySQL中省略了不支持类型的CAST。虽然我们现在不想改变它,但我们会发出警告以表明它已发生。当一个CAST与一个根本不支持CAST的较老的MySQL版本(<4)一起使用时,也会发出一个警告,在这种情况下它也被跳过。

    参考文献:#3237

  • [mysql] [bug] mysql.SET类型进行了大检查,以便不再假定空字符串或具有单个空字符串值的集合实际上一个带有单个空字符串的集合;相反,这是默认处理为空集。为了处理实际上希望将空值''作为合法值的mysql.SET的持久性,添加了一个新的按位操作模式, mysql.SET.retrieve_as_bitwise标志,该标志将使用它们的位标定位来保持并明确检索值。存储和检索本地不转换unicode的驱动程序配置的unicode值也会被修复。

    参考文献:#3283

  • [mysql] [bug] The ColumnOperators.match() operator is now handled such that the return type is not strictly assumed to be boolean; it now returns a Boolean subclass called MatchType. 该类型在Python表达式中使用时仍然会产生布尔行为,但方言可以在结果时覆盖其行为。在MySQL的情况下,虽然MATCH运算符通常用在表达式中的布尔上下文中,但如果实际查询匹配表达式的值,则会返回浮点值;此值与SQLAlchemy的基于C的布尔处理器不兼容,所以MySQL的结果集行为现在遵循Float类型的行为。还添加了一个新的操作符对象notmatch_op,以便更好地允许方言定义匹配操作的否定。

    参考文献:#3263

  • [mysql] [bug] MySQL布尔符号“true”,“false”再次工作。0.9 #2682中的变化不允许MySQL方言在“IS”/“IS NOT”的上下文中使用“true”和“false”符号,但MySQL甚至支持这种语法尽管它没有布尔类型。MySQL remains “non native boolean”, but the true() and false() symbols again produce the keywords “true” and “false”, so that an expression like column.is_(true()) again works on MySQL.

    参考文献:#3186

  • [mysql] [bug] 现在,MySQL方言将禁用ConnectionEvents.handle_error()事件触发它在内部用于检测表是否存在的语句。这是通过使用执行选项skip_user_error_events来实现的,该选项为该执行的范围禁用句柄错误事件。通过这种方式,重写异常的用户代码不需要担心偶尔需要捕获SQLAlchemy特定异常的MySQL方言或其他方言。

  • [mysql] [bug] 将MySQL连接器的“raise_on_warnings”的默认值更改为False。由于某种原因,这被设置为True。不幸的是,“缓冲”标志必须保持为True,因为MySQL连接器不允许游标被关闭,除非所有结果都被全部获取。

    参考文献:#2515

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

    这个改变也被backported改为:0.9.9

    参考文献:#3275

源码¶ T0>

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

    也可以看看

    Partial Indexes

    这个改变也被backported改为:0.9.9

    参考文献:pull request bitbucket:42

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

    也可以看看

    pysqlcipher

    这个改变也被backported改为:0.9.9

  • [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。

    这个改变也是backported改为:0.9.8

    参考文献:#3211

  • [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.

    这个改变也被backported改为:0.9.7

    参考文献:#3130

  • [sqlite] [bug] UNIQUE和FOREIGN KEY约束现在完全反映在SQLite中,包含名称和不包含名称。以前,外键名称被忽略,未命名的唯一约束被忽略。感谢Jon Nelson寻求帮助。

    参考文献:#3261#3244

  • [sqlite] [bug] The SQLite dialect, when using the sqlite.DATE, sqlite.TIME, or sqlite.DATETIME types, and given a storage_format that only renders numbers, will render the types in DDL as DATE_CHAR, TIME_CHAR, and DATETIME_CHAR, so that despite the lack of alpha characters in the values, the column will still deliver the “text affinity”. 通常这不是必需的,因为默认存储格式中的文本值已经暗示了文本。

    也可以看看

    Date and Time Types

    参考文献:#3257

  • [sqlite] [bug] SQLite现在支持反映来自临时表的唯一约束;以前,这会因类型错误而失败。拉约请求Johannes Erdfelt提供。

    也可以看看

    SQLite/Oracle have distinct methods for temporary table/view name reporting - changes regarding SQLite temporary table and view reflection.

    参考文献:#3203拉取请求bitbucket:31

  • [sqlite] [bug] 添加了Inspector.get_temp_table_names()Inspector.get_temp_view_names();目前,只有SQLite和Oracle方言支持这些方法。The return of temporary table and view names has been removed from SQLite and Oracle’s version of Inspector.get_table_names() and Inspector.get_view_names(); other database backends cannot support this information (such as MySQL), and the scope of operation is different in that the tables can be local to a session and typically aren’t supported in remote schemas.

    参考文献:#3204

MSSQL ¶ T0>

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

    这个改变也被backported改为:0.9.7

    参考文献:请求github:98

  • [mssql] [feature] SQL Server 2012 now recommends VARCHAR(max), NVARCHAR(max), VARBINARY(max) for large text/binary types. MSSQL方言现在将基于版本检测以及新的deprecate_large_types标志尊重它。

    参考文献:#3039

  • [mssql] [changed] 使用pyodbc时,SQL Server的基于主机名的连接格式将不再指定默认的“驱动程序名称”,并且如果缺少该驱动程序名称,则会发出警告。SQL Server的最佳驱动程序名称经常更改并且是每个平台,因此基于主机名的连接需要指定此名称。基于DSN的连接是首选。

    参考文献:#3182

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

    这个改变也是backported改为:0.9.8

    参考文献:#3151

  • [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).

    这个改变也被backported改为:0.9.5

    参考文献:#3025

  • [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.

    This change is also backported to: 0.9.7, 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. 这个参数不应该被继续使用。

    This change is also backported to: 0.9.7, 0.8.7

    参考文献:#3091

预言¶ T0>

  • [oracle] [feature] 通过将?service_name=<name>传递给URL,增加了对特定服务名称的cx_oracle连接的支持,而不是tns名称。请求礼貌SławomirEhlert。

    参考文献:请求github:152

  • [oracle] [feature] 新的Oracle DDL特性用于表,索引:COMPRESS,BITMAP。Gabor Gombas提供补丁。

  • [oracle] [feature] 添加了对Oracle下的CTE的支持。This includes some tweaks to the aliasing syntax, as well as a new CTE feature CTE.suffix_with(), which is useful for adding in special Oracle-specific directives to the CTE.

    参考文献:#3220

  • [oracle] [feature] 新增了对Oracle表选项ON COMMIT的支持。

  • [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.

    这个改变也是backported改为:0.9.8

    参考文献:#2138

  • [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.

    这个改变也被backported改为:0.9.7

    参考文献:#3128

  • [oracle] [bug] An alias name will be properly quoted when referred to using the %(name)s token inside the Select.with_hint() method. 以前,Oracle后端没有实现这种引用。

杂项¶ T0>

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

    这个改变也被backported改为:0.9.5

    参考文献:pull request bitbucket:21

  • [feature] [ext] 添加了一个新的扩展套件sqlalchemy.ext.baked这个简单但不同寻常的系统可以显着节省Python构建和处理orm Query对象,从查询构建到渲染字符串SQL语句。

    也可以看看

    Baked Queries

    参考文献:#3054

  • [feature] [examples] 一套新的示例,致力于从多个角度详细研究SQLAlchemy ORM和Core以及DBAPI的性能。该套件在一个容器内运行,该容器通过控制台输出以及通过RunSnake工具以图形方式提供内置的分析显示。

    也可以看看

    Performance

  • [feature] [ext] The sqlalchemy.ext.automap extension will now set cascade="all, delete-orphan" automatically on a one-to-many relationship/backref where the foreign key is detected as containing one or more non-nullable columns. 在这种情况下,该参数出现在传递给automap.generate_relationship()的关键字中,并且仍然可以被覆盖。Additionally, if the ForeignKeyConstraint specifies ondelete="CASCADE" for a non-nullable or ondelete="SET NULL" for a nullable set of columns, the argument passive_deletes=True is also added to the relationship. 请注意,并非所有后端都支持ondelete的反射,但后端包括Postgresql和MySQL。

    参考文献:#3210

  • [removed] Drizzle方言已从Core中删除;它现在可以作为sqlalchemy-drizzle,一种独立的第三方方言。该方言仍然基于SQLAlchemy中存在的MySQL方言。

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

    这个改变也被backported改为:0.9.9

    参考文献:请求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.

    这个改变也被backported改为:0.9.9

  • [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.

    这个改变也被backported改为:0.9.9

  • [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.

    这个改变也是backported改为:0.9.8

    参考文献:#3208

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

    这个改变也是backported改为:0.9.8

    参考文献:#3191

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

    这个改变也是backported改为:0.9.8

  • [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。

    这个改变也是backported改为:0.9.8

  • [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中引入的回归。

    这个改变也是backported改为:0.9.8

    参考文献:#3168

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

    这个改变也被backported改为:0.9.7

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

    这个改变也被backported改为:0.9.7

    参考文献:#3097

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

    这个改变也被backported改为:0.9.5

    参考:请求github:95

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

    这个改变也被backported改为:0.9.5

    References: #2830, pull request bitbucket:2830

  • [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 >

    This change is also backported to: 0.9.5, 0.8.7

    参考文献:#3062

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

    This change is also backported to: 0.9.5, 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é。

    This change is also backported to: 0.9.5, 0.8.7

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