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

SQLAlchemy 1.1文档

0.7更新日志

0.7.11 ¶ T0>

没有发布日期

ORM ¶ T0>

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

    参考文献:#2807

  • [orm] [bug] Fixed bug when a query of the form: query(SubClass).options(subqueryload(Baseclass.attrname)), where SubClass is a joined inh of BaseClass, would fail to apply the JOIN inside the subquery on the attribute load, producing a cartesian product. 填充的结果仍然是正确的,因为额外的行只是被忽略了,所以这个问题可能会出现在应用程序正常工作时性能下降。

    参考文献:#2699

  • [orm] [bug] Fixed bug in unit of work whereby a joined-inheritance subclass could insert the row for the “sub” table before the parent table, if the two tables had no ForeignKey constraints set up between them.

    参考文献:#2689

  • [orm] [bug] Improved the error message emitted when a “backref loop” is detected, that is when an attribute event triggers a bidirectional assignment between two other attributes with no end. 这种情况不仅发生在分配了错误类型的对象时,而且当某个属性被错误地配置为反向引用到现有的backref对时。

    参考文献:#2674

  • [orm] [bug] A warning is emitted when a MapperProperty is assigned to a mapper that replaces an existing property, if the properties in question aren’t plain column-based properties. 关系属性的替换很少(从来没有?)意图是什么,通常是指映射器错误配置。这也会警告,如果backref在继承关系(在0.8中是一个错误)在现有配置上进行自我配置,

    参考文献:#2674

发动机¶ T0>

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

    参考文献:#2851

SQL ¶ T0>

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

    参考文献:#2801

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

    参考文献:#2783

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

    参考文献:#2784

的PostgreSQL ¶ T0>

  • [postgresql] [feature] Added support for Postgresql’s traditional SUBSTRING function syntax, renders as “SUBSTRING(x FROM y FOR z)” when regular func.substring() is used. Courtesy GunnlaugurÞórBriem。

    参考文献:#2676

MySQL的¶ T0>

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

    参考文献:#2791

杂项¶ T0>

  • [bug] [tests] 修复了test_execute中的“logging”导入问题,该问题在某些linux平台上无法使用。

    参考文献:#2669拉取请求41

0.7.10 ¶ T0>

发布日期:2013年2月7日

ORM ¶ T0>

  • [orm] [bug] 修复了创建任意数量的sessionmaker对象时可能发生的内存泄漏。由sessionmaker创建的匿名子类在取消引用时不会被垃圾收集,因为事件包中剩余的类级别引用。这个问题也适用于任何使用ad-hoc子类与事件分派器结合使用的自定义系统。

    参考文献:#2650

  • [orm] [bug] Query.merge_result() can now load rows from an outer join where an entity may be None without throwing an error.

    参考文献:#2640

  • [orm] [bug] The MutableComposite type did not allow for the MutableBase.coerce() method to be used, even though the code seemed to indicate this intent, so this now works and a brief example is added. 作为一个副作用,这个事件处理程序的机制已经改变,所以新的MutableComposite类型不再添加每个类型的全局事件处理程序。也在0.8.0b2.

    参考文献:#2624

  • [orm] [bug] Fixed Session accounting bug whereby replacing a deleted object in the identity map with another object of the same primary key would raise a “conflicting state” error on rollback(), if the replaced primary key were established either via non-unitofwork-established INSERT statement or by primary key switch of another instance.

    参考文献:#2583

发动机¶ T0>

SQL ¶ T0>

  • [sql] [bug] Backported adjustment to __repr__ for TypeDecorator to 0.7, allows PickleType to produce a clean repr() to help with Alembic.

    参考文献:#2594#2584

  • [sql] [bug] Fixed bug where Table.tometadata() would fail if a Column had both a foreign key as well as an alternate ”.key” name for the column.

    参考文献:#2643

  • [sql] [bug] Fixed bug where using server_onupdate= without passing the “for_update=True” flag would apply the default object to the server_default, blowing away whatever was there. 明确的for_update = True参数不应该与此用法一起使用(尤其是因为文档显示的示例没有使用它),因此现在使用给定的默认对象的副本在内部进行排列,如果该标志未设置为什么对应于这个参数。

    参考文献:#2631

  • [sql] [gae] [mysql] Added a conditional import to the gaerdbms dialect which attempts to import rdbms_apiproxy vs. rdbms_googleapi to work on both dev and production platforms. 现在也尊重instance属性。Courtesy Sean Lynch。还支持增强功能以​​允许用户名/密码以及修复从0.8开始的错误代码解释。

    参考文献:#2649

MySQL的¶ T0>

  • [mysql] [feature] 在OurSQL方言中添加了“raise_on_warnings”标志。

    参考文献:#2523

  • [mysql] [feature] 在MySQLdb方言中加入了“read_timeout”标志。

    参考文献:#2554

源码¶ T0>

  • [sqlite] [bug] 对0.7.9版本中发布的SQLite相关问题进行更多调整,以便在反映外键时拦截旧版SQLite引用字符。除了拦截双引号外,其他引号字符(如括号,反引号和单引号)现在也被拦截。

    参考文献:#2568

MSSQL ¶ T0>

  • [mssql] [bug] Fixed bug whereby using “key” with Column in conjunction with “schema” for the owning Table would fail to locate result rows due to the MSSQL dialect’s “schema rendering” logic’s failure to take .key into account.

  • [mssql] [bug] 在mssql信息模式中添加了一个Py3K条件,用于在不必要的.decode()调用中修复Py3k中的反射

    参考文献:#2638

预言¶ T0>

  • [oracle] [bug] The Oracle LONG type, while an unbounded text type, does not appear to use the cx_Oracle.LOB type when result rows are returned, so the dialect has been repaired to exclude LONG from having cx_Oracle.LOB filtering applied.

    参考文献:#2620

  • [oracle] [bug] Repaired the usage of .prepare() in conjunction with cx_Oracle so that a return value of False will result in no call to connection.commit(), hence avoiding “no transaction” errors. 现在已经证明两阶段事务以SQLAlchemy和cx_oracle的方式发挥作用,但是在驱动程序中观察到警告;请查看文档以获取详细信息。

    参考文献:#2611

  • [oracle] [bug] 将setinputsizes()步骤中排除的cx_oracle类型列表更改为仅包含STRING和UNICODE; CLOB和NCLOB被删除。这是为了解决executemany()调用破坏的cx_oracle行为。在0.8中,应用了相同的更改,但也可以通过exclude_setinputsizes参数进行配置。

    参考文献:#2561

0.7.9 ¶ T0>

发布时间:2012年10月1日

ORM ¶ T0>

  • [orm] [bug] Fixed bug mostly local to new AbstractConcreteBase helper where the “type” attribute from the superclass would not be overridden on the subclass to produce the “reserved for base” error message, instead placing a do-nothing attribute there. 这与使用ConcreteBase以及经典具体映射的所有行为不一致,其中多态基本的“类型”列将在子类中显式禁用,除非明确覆盖。

  • [orm] [bug] 当lazy ='dynamic'与uselist = False组合时,会发出警告。这是0.8中的异常提升。

  • [orm] [bug] Fixed bug whereby user error in related-object assignment could cause recursion overflow if the assignment triggered a backref of the same name as a bi-directional attribute on the incorrect class to the same target. 现在提出一个信息错误。

  • [orm] [bug] Fixed bug where incorrect type information would be passed when the ORM would bind the “version” column, when using the “version” feature. 测试Daniel Miller提供。

    参考文献:#2539

  • [orm] [bug] Extra logic has been added to the “flush” that occurs within Session.commit(), such that the extra state added by an after_flush() or after_flush_postexec() hook is also flushed in a subsequent flush, before the “commit” completes. 随后对flush()的调用将继续,直到after_flush挂钩停止添加新状态。如果每次破坏after_flush()挂钩添加新内容,“overflow”计数器也会到位。

    参考文献:#2566

发动机¶ T0>

  • [engine] [feature] 事件系统内存使用的显着改进;实例级集合不再为特定类型的事件创建,除非为该事件建立实例级侦听器。

    参考文献:#2516

  • [engine] [bug] Fixed bug whereby a disconnect detect + dispose that occurs when the QueuePool has threads waiting for connections would leave those threads waiting for the duration of the timeout on the old pool (or indefinitely if timeout was disabled). 该修补程序现在通知一个特殊的异常情况下的服务员,并让他们进入新的池。

    参考文献:#2522

  • [engine] [bug] 在mysql / __ init__.py中添加了gaerdbms导入,但没有阻止加载新的GAE方言。

    参考文献:#2529

  • [engine] [bug] Fixed cextension bug whereby the “ambiguous column error” would fail to function properly if the given index were a Column object and not a string. 请注意,这里还存在一些列定位问题,这些问题在0.8中得到修复。

    参考文献:#2553

  • [engine] [bug] Fixed the repr() of Enum to include the “name” and “native_enum” flags. 帮助Alembic自动生成。

SQL ¶ T0>

  • [sql] [bug] Fixed the DropIndex construct to support an Index associated with a Table in a remote schema.

    参考文献:#2571

  • [sql] [bug] Fixed bug in over() construct whereby passing an empty list for either partition_by or order_by, as opposed to None, would fail to generate correctly. Courtesy GunnlaugurÞórBriem。

    参考文献:#2574

  • [sql] [bug] Fixed CTE bug whereby positional bound parameters present in the CTEs themselves would corrupt the overall ordering of bound parameters. 这主要影响SQL Server作为具有位置绑定+ CTE支持的平台。

    参考文献:#2521

  • [sql] [bug] Fixed more un-intuitivenesses in CTEs which prevented referring to a CTE in a union of itself without it being aliased. 现在,CTE只对名称进行渲染,仅渲染给定名称的最外面的CTE - 所有其他引用都以名称呈现。这甚至包括引用同一CTE对象的不同版本的其他CTE / SELECT,例如SELECT或SELECT的UNION ALL。在这种情况下,我们略微放松了对象身份和词汇身份之间的通常联系。两个不相关的CTE之间的真实姓名冲突现在引发了一个错误。

  • [sql] [bug] quoting is applied to the column names inside the WITH RECURSIVE clause of a common table expression according to the quoting rules for the originating Column.

    参考文献:#2512

  • [sql] [bug] 修正0.7.6中引入的回归,在某些“克隆+替换”场景中,SELECT语句的FROM列表可能不正确。

    参考文献:#2518

  • [sql] [bug] Fixed bug whereby usage of a UNION or similar inside of an embedded subquery would interfere with result-column targeting, in the case that a result-column had the same ultimate name as a name inside the embedded UNION.

    参考文献:#2552

  • [sql] [bug] 修复了自0.6开始的有关结果行定位的回归。应该可以使用带有基于字符串的列的select()语句,即select(['id','name'])。select_from('mytable'),并使该语句可以通过Column对象进行定位这些名字;这是查询(MyClass).from_statement(some_statement)工作的机制。At some point the specific case of using select([‘id’]), which is equivalent to select([literal_column(‘id’)]), stopped working here, so this has been re-instated and of course tested.

    参考文献:#2558

  • [sql] [bug] 在ColumnOperators基础中添加了缺少的运算符is_(),isnot(),以便这些可用的运算符像所有其他运算符一样存在于方法中。/ T2>

    参考文献:#2544

的PostgreSQL ¶ T0>

  • [postgresql] [bug] 反映的主键约束中的列现在按约束本身定义的顺序返回,而不是按照表的顺序排列。Courtesy GunnlaugurÞórBriem ..

    参考文献:#2531

  • [postgresql] [bug] 在我们用来检测与PG断开的消息列表中添加了“终止连接”,这在服务器重启时出现在某些版本中。¶ T2>

    参考文献:#2570

MySQL的¶ T0>

  • [mysql] [bug] 更新mysqlconnector接口以使用更新的“client flag”和“charset”API,由David McNelis提供。

源码¶ T0>

  • [sqlite] [feature] 添加了对SQLite中实现的localtimestamp()SQL函数的支持,由Richard Mitchell提供

  • [sqlite] [bug] Adjusted a very old bugfix which attempted to work around a SQLite issue that itself was “fixed” as of sqlite 3.6.14, regarding quotes surrounding a table name when using the “foreign_key_list” pragma. The fix has been adjusted to not interfere with quotes that are actually in the name of a column or table, to as much a degree as possible; sqlite still doesn’t return the correct result for foreign_key_list() if the target table actually has quotes surrounding its name, as part of its name (i.e. “”“mytable”“”).

    参考文献:#2568

  • [sqlite] [bug] 调整列默认反射代码以将非字符串值转换为字符串,以适应不将默认信息作为字符串传递的旧SQLite版本。¶ t2 >

    参考文献:#2265

MSSQL ¶ T0>

  • [mssql] [bug] Fixed compiler bug whereby using a correlated subquery within an ORDER BY would fail to render correctly if the stament also used LIMIT/OFFSET, due to mis-rendering within the ROW_NUMBER() OVER clause. 修正礼貌sayap

    参考文献:#2538

  • [mssql] [bug] 修正了编译器的bug,如果它有一个“offset”属性,那么给定的select()会被修改,导致构造不能再次正确编译。/ T2>

    参考文献:#2545

  • [mssql] [bug] 修正了如果在多个模式中存在相同约束/表的话,主键约束的反射会使列加倍。

0.7.8 ¶ T0>

发布时间:2012年6月16日星期六

ORM ¶ T0>

  • [orm] [feature] 不再废弃flush()的'objects'参数,因为已经识别出一些有效的用例。

  • [orm] [bug] Fixed bug whereby subqueryload() from a polymorphic mapping to a target would incur a new invocation of the query for each distinct class encountered in the polymorphic result.

    参考文献:#2480

  • [orm] [bug] Fixed bug in declarative whereby the precedence of columns in a joined-table, composite column (typically for id) would fail to be correct if the columns contained names distinct from their attribute names. 这会导致针对实体属性的primaryjoin条件不正确。相关的,因为这应该是其中的一部分,这是。

    参考文献:#2491#1892

  • [orm] [bug] 修正了不接受标识参数的identity_key()函数。¶ T0>

    参考文献:#2508

  • [orm] [bug] 修复了populate_existing选项不会传播给子查询渴望加载器的错误。¶ T0>

    参考文献:#2497

发动机¶ T0>

  • [engine] [bug] Fixed memory leak in C version of result proxy whereby DBAPIs which don’t deliver pure Python tuples for result rows would fail to decrement refcounts correctly. 最受关注的DBAPI是pyodbc。

    参考文献:#2489

  • [engine] [bug] Fixed bug affecting Py3K whereby string positional parameters passed to engine/connection execute() would fail to be interpreted correctly, due to __iter__ being present on Py3K string..

    参考文献:#2503

SQL ¶ T0>

  • [sql] [bug] 将BIGINT添加到类型.__ all__,BIGINT,BINARY,VARBINARY到sqlalchemy模块名称空间,再加上测试以确保不再发生此破坏。

    参考文献:#2499

  • [sql] [bug] Repaired common table expression rendering to function correctly when the SELECT statement contains UNION or other compound expressions, courtesy btbuilder.

    参考文献:#2490

  • [sql] [bug] 修正了bug,即append_column()在克隆的select()构造中无法正确运行,由GunnlaugurÞórBriem提供。

    参考文献:#2482

的PostgreSQL ¶ T0>

  • [postgresql] [bug] 在反映枚举时删除了不必要的表子句。Courtesy GunnlaugurÞórBriem。

    参考文献:#2510

MySQL的¶ T0>

  • [mysql] [feature] 为Google App Engine添加了一种新的方言。Courtesy Richie Foreman。

    参考文献:#2484

预言¶ T0>

  • [oracle] [bug] 向oracle添加了ROWID。* ¶ T0>

    参考文献:#2483

0.7.7 ¶ T0>

发布时间:2012年5月5日星期六

ORM ¶ T0>

  • [orm] [feature] Added prefix_with() method to Query, calls upon select().prefix_with() to allow placement of MySQL SELECT directives in statements. Courtesy Diana Clarke

    参考文献:#2443

  • [orm] [feature] 为@validates include_removes添加了新标志。如果为True,则collection remove和attribute del事件也将被发送到验证函数,该函数在使用此标志时接受附加参数“is_remove”。

  • [orm] [bug] Fixed issue in unit of work whereby setting a non-None self-referential many-to-one relationship to None would fail to persist the change if the former value was not already loaded..

    参考文献:#2477

  • [orm] [bug] 修正0.7.6引入的错误,其中column_mapped_collection用于映射为连接或其他间接选择的列将无法运行。

    参考文献:#2409

  • [orm] [bug] Fixed bug whereby polymorphic_on column that’s not otherwise mapped on the class would be incorrectly included in a merge() operation, raising an error.

    参考文献:#2449

  • [orm] [bug] Fixed bug in expression annotation mechanics which could lead to incorrect rendering of SELECT statements with aliases and joins, particularly when using column_property().

    参考文献:#2453

  • [orm] [bug] 修正了会阻止OrderingList被pickleable的错误。礼貌Jeff Dairiki

    参考文献:#2454

  • [orm] [bug] Fixed bug in relationship comparisons whereby calling unimplemented methods like SomeClass.somerelationship.like() would produce a recursion overflow, instead of NotImplementedError.

SQL ¶ T0>

  • [sql] [feature] 添加了新的连接事件dbapi_error()。在SQLAlchemy修改游标状态之前调用所有DBAPI级错误传递原始DBAPI异常。

  • [sql] [bug] 在创建索引时不删除警告;虽然这可能不是用户想要的,但它是一个有效的用例,因为索引可能只是某个特定名称索引的占位符。

  • [sql] [bug] 如果在调用“with engine.begin()”时conn.begin()失败,则新获取的Connection在通常向前传播异常之前显式关闭。¶< / T2>

  • [sql] [bug] 将BINARY,VARBINARY添加到类型.__ all __。

    参考文献:#2474

的PostgreSQL ¶ T0>

  • [postgresql] [feature] Added new for_update/with_lockmode() options for Postgresql: for_update=”read”/ with_lockmode(“read”), for_update=”read_nowait”/ with_lockmode(“read_nowait”). 这些分别发出“FOR SHARE”和“FOR NOWAREAIT”。Courtesy Diana Clarke

    参考文献:#2445

  • [postgresql] [bug] 在反映域时删除了不必要的表子句。

    参考文献:#2473

MySQL的¶ T0>

  • [mysql] [bug] Fixed bug whereby column name inside of “KEY” clause for autoincrement composite column with InnoDB would double quote a name that’s a reserved word. Courtesy Jeff Dairiki。

    参考文献:#2460

  • [mysql] [bug] Fixed bug whereby get_view_names() for “information_schema” schema would fail to retrieve views marked as “SYSTEM VIEW”. 礼貌Matthew Turland。

  • [mysql] [bug] Fixed bug whereby if cast() is used on a SQL expression whose type is not supported by cast() and therefore CAST isn’t rendered by the dialect, the order of evaluation could change if the casted expression required that it be grouped; grouping is now applied to those expressions.

    参考文献:#2467

源码¶ T0>

  • [sqlite] [feature] 新增SQLite执行选项“sqlite_raw_colnames = True”,将绕过尝试从SQLite cursor.description返回的列名称中删除“。”。

    参考文献:#2475

  • [sqlite] [bug] When the primary key column of a Table is replaced, such as via extend_existing, the “auto increment” column used by insert() constructs is reset. 以前它会继续引用前一个主键列。

    参考文献:#2525

MSSQL ¶ T0>

  • [mssql] [feature] 将临时create_engine标志supports_unicode_bind添加到PyODBC方言中,以强制方言是否将Python unicode文字传递给PyODBC。

  • [mssql] [bug] 在使用pyodbc方言时修复了use_scope_identity create_engine()标志。如果设置为False,以前该标志将被忽略。当设置为False时,在每个INSERT之后,您将在“implicit_returning”设置为False的表中获得最后插入的ID后的“SELECT @@ identity”。

  • [mssql] [bug] UPDATE..FROM syntax with SQL Server requires that the updated table be present in the FROM clause when an alias of that table is also present in the FROM clause. 当FROM出现在第一位时,更新的表现在总是存在于FROM中。礼貌sayap。

    参考文献:#2468

0.7.6 ¶ T0>

发布时间:2012年3月14日星期三

ORM ¶ T0>

  • [orm] [feature] 在会话中添加了“no_autoflush”上下文管理器,与with一起使用:将临时禁用autoflush。

  • [orm] [feature] 在Query中添加了cte()方法,从Core中调用公共表表达式支持(见下文)

    参考文献:#1859

  • [orm] [feature] Added the ability to query for Table-bound column names when using query(sometable).filter_by(colname=value).

    参考文献:#2400

  • [orm] [bug] 修正了事件注册错误,主要显示事件没有在事件与Session类关联后创建的sessionmaker()中注册。¶ t2 >

    参考文献:#2424

  • [orm] [bug] Fixed bug whereby a primaryjoin condition with a “literal” in it would raise an error on compile with certain kinds of deeply nested expressions which also needed to render the same bound parameter name more than once.

    参考文献:#2425

  • [orm] [bug] 删除对映射对象进行多次删除时受影响的行数的检查。如果在两行之间存在ON DELETE CASCADE,我们无法从DBAPI获得准确的行计数;在任何情况下,大多数DBAPI都不支持此特定计数,MySQLdb是值得注意的情况。

    参考文献:#2403

  • [orm] [bug] 修正了使用attribute_mapped_collection或column_mapped_collection的对象无法被pickle的问题。

    参考文献:#2409

  • [orm] [bug] Fixed bug whereby MappedCollection would not get the appropriate collection instrumentation if it were only used in a custom subclass that used @collection.internally_instrumented.

    参考文献:#2406

  • [orm] [bug] Fixed bug whereby SQL adaption mechanics would fail in a very nested scenario involving joined-inheritance, joinedload(), limit(), and a derived function in the columns clause.

    参考文献:#2419

  • [orm] [bug] 修复了CascadeOptions的repr()以包含refresh-expire。还重做了CascadeOptions成为

    参考文献:#2417

  • [orm] [bug] Improved the “declarative reflection” example to support single-table inheritance, multiple calls to prepare(), tables that are present in alternate schemas, establishing only a subset of classes as reflected.

  • [orm] [bug] 缩放在flush()中应用的测试,以检查UPDATE对一个表内部分为空的PK,只有在真正发生UPDATE时才会发生。¶< / T2>

    参考文献:#2390

  • [orm] [bug] Fixed bug whereby if a method name conflicted with a column name, a TypeError would be raised when the mapper tried to inspect the __get__() method on the method object.

    参考文献:#2352

发动机¶ T0>

  • [engine] [feature] 为连接添加了“no_parameters = True”执行选项。如果不存在任何参数,则会将该语句作为cursor.execute(语句)传递,从而在不存在参数集合时调用DBAPIs行为;对于psycopg2和mysql-python,这意味着不会解释字符串中的%符号。这只会发生在这个选项中,而不仅仅是参数列表是空白的,否则这会导致SQL表达式的不一致的行为,这通常会导致百分号转义(并且在编译时,不能提前知道参数是否存在于一些情况)。

    参考文献:#2407

  • [engine] [feature] 将create_engine的pool_reset_on_return参数添加到控制权,可以控制“连接返回”行为。还为pool.reset_on_return添加了新的参数'rollback','commit',None,以允许对连接返回活动的更多控制。

    参考文献:#2378

  • [engine] [feature] 为引擎,连接添加了一些体面的上下文管理器:

    with engine.begin() as conn:
        <work with conn in a transaction>

    和:

    with engine.connect() as conn:
        <work with conn>

    在engine.begin()完成,提交或回滚事务时出错都关闭连接。

  • [engine] [bug] 添加了对MockConnection(即与strategy =“mock”一起使用)的execution_options()调用,它充当参数传递。

SQL ¶ T0>

  • [sql] [feature] 增加了对SQL标准公用表表达式(CTE)的支持,允许SELECT对象作为CTE源(DML尚未支持)。这是通过任何select()构造的cte()方法调用的。

    参考文献:#1859

  • 修正了内核中的内存泄漏问题,当C扩展与特定类型的结果提取一起使用时,尤其是当调用orm query.count()时,会发生内存泄漏。 [sql] [bug]

    参考文献:#2427

  • [sql] [bug] Fixed issue whereby attribute-based column access on a row would raise AttributeError with non-C version, NoSuchColumnError with C version. 现在在两种情况下都会引发AttributeError。

    参考文献:#2398

  • [sql] [bug] 添加了对列中的.key作为结果集行中的字符串标识符的支持。.key当前被列为列的“备用”名称,并被以该常量名称具有该键值的列的名称取代。对于SQLAlchemy的下一个主要版本,我们可能会反转此优先级,以便.key优先,但尚未确定。

    参考文献:#2392

  • [sql] [bug] 当insert()或update()构造的values()子句中声明不存在列时,会发出警告。将在0.8中移至异常。

    参考文献:#2413

  • [sql] [bug] A significant change to how labeling is applied to columns in SELECT statements allows “truncated” labels, that is label names that are generated in Python which exceed the maximum identifier length (note this is configurable via label_length on create_engine()), to be properly referenced when rendered inside of a subquery, as well as to be present in a result set row using their original in-Python names.

    参考文献:#2396

  • [sql] [bug] Fixed bug in new “autoload_replace” flag which would fail to preserve the primary key constraint of the reflected table.

    参考文献:#2402

  • [sql] [bug] 当传递的参数不能被解释为列或表达式时,索引会引发。当没有列创建索引时,会发出警告。

    参考文献:#2380

MySQL的¶ T0>

  • [mysql] [feature] 增加了对MySQL索引和主键约束类型的支持。USING)通过新的mysql_using参数来索引和PrimaryKeyConstraint,由Diana Clarke提供。

    参考文献:#2386

  • [mysql] [feature] 增加了对所有MySQL方言的“isolation_level”参数的支持。感谢mu_mind这里的补丁。

    参考文献:#2394

源码¶ T0>

  • [sqlite] [bug] 修正C扩展中的错误,其中字符串格式不会应用于以整数形式返回的数值;这主要影响SQLite,它不会保持数字比例设置。

    参考文献:#2432

MSSQL ¶ T0>

  • [mssql] [feature] 在UpdateBase上使用新的with_hint()方法增加了对MSSQL INSERT,UPDATE和DELETE表提示的支持。

    参考文献:#2430

预言¶ T0>

  • [oracle] [feature] 添加了一个新的create_engine()标志coerce_to_decimal = False,禁用精度数值处理,通过将所有数值转换为Decimal可以增加大量的开销。¶ t2 >

    参考文献:#2399

  • [oracle] [bug] 增加了LONG 缺少的编译支持¶

    参考文献:#2401

  • [oracle] [bug] 将'LEVEL'添加到Oracle的保留字列表中。

    参考文献:#2435

杂项¶ T0>

  • [bug] [examples] Altered _params_from_query() function in Beaker example to pull bindparams from the fully compiled statement, as a quick means to get everything including subqueries in the columns clause, etc.

0.7.5 ¶ T0>

发布时间:2012年1月28日星期六

ORM ¶ T0>

  • [orm] [feature] 在declarative_base()中添加了“class_registry”参数。允许两个或更多的声明式库共享相同的类名注册表。

  • [orm] [feature] query.filter()接受通过AND连接的多个条件,即query.filter(x == y,z> q,...)¶< / T2>

  • [orm] [feature] 增加了关系加载器选项的新功能,以允许“默认”加载器策略。将'*'传递给任何joinedload(),lazyload(),subqueryload()或noload(),并成为用于所有关系的加载器策略,除了在查询中明确声明的那些策略。感谢即将到来的贡献者Kent Bower提供了一个详尽且写得很好的测试套件!

    参考文献:#2351

  • [orm] [feature] 添加了新的声明性反射示例,说明如何最好地将表反射与声明混合以及使用一些新的特性。

    参考文献:#2356

  • [orm] [bug] Fixed issue where modified session state established after a failed flush would be committed as part of the subsequent transaction that begins automatically after manual call to rollback(). 会话的状态在rollback()中进行检查,如果存在新状态,将发出警告,并第二次调用restore_snapshot(),放弃这些更改。

    参考文献:#2389

  • [orm] [bug] 固定了0.7.4的回归,从超类中使用已经检测过的列作为“polymorphic_on”,无法解析底层Column。

    参考文献:#2345

  • [orm] [bug] 如果xyzload_all()与两个非连接关系不正确地使用,则引发异常

    参考文献:#2370

  • [orm] [bug] Fixed bug whereby event.listen(SomeClass) forced an entirely unnecessary compile of the mapper, making events very hard to set up at module import time (nobody noticed this ??)

    参考文献:#2367

  • [orm] [bug] Fixed bug whereby hybrid_property didn’t work as a kw arg in any(), has().

  • [orm] [bug] 确保所有ORM异常的pickleability能够兼容多处理。

    参考文献:#2371

  • [orm] [bug] implemented standard “can’t set attribute” / “can’t delete attribute” AttributeError when setattr/delattr used on a hybrid that doesn’t define fset or fdel.

    参考文献:#2353

  • [orm] [bug] Fixed bug where unpickled object didn’t have enough of its state set up to work correctly within the unpickle() event established by the mutable object extension, if the object needed ORM attribute access within __eq__() or similar.

    参考文献:#2362

  • [orm] [bug] Fixed bug where “merge” cascade could mis-interpret an unloaded attribute, if the load_on_pending flag were used with relationship(). 感谢Kent Bower进行测试。

    参考文献:#2374

  • [orm] Fixed regression from 0.6 whereby if “load_on_pending” relationship() flag were used where a non-“get()” lazy clause needed to be emitted on a pending object, it would fail to load.

发动机¶ T0>

  • [engine] [bug] 将__reduce__添加到StatementError,DBAPIError列错误中,以便异常可以使用,就像使用多处理时一样。但是,并不是所有的DBAPI都支持这一点,比如psycopg2.

    参考文献:#2371

  • [engine] [bug] Improved error messages when a non-string or invalid string is passed to any of the date/time processors used by SQLite, including C and Python versions.

    参考文献:#2382

  • [engine] [bug] Fixed bug whereby a table-bound Column object named “_” which matched a column labeled as “_” could match inappropriately when targeting in a result set row.

    参考文献:#2377

  • [engine] [bug] Fixed bug in “mock” strategy whereby correct DDL visit method wasn’t called, resulting in “CREATE/DROP SEQUENCE” statements being duplicated

    参考文献:#2384

SQL ¶ T0>

  • [sql] [feature] 新的反射功能“autoload_replace”;当在表格上设置为False时,表格可以自动加载而不需要替换现有的列。允许构建更灵活的表结构/反射链,包括它有助于将声明与表反射相结合。请参阅wiki上的新示例。

    参考文献:#2356

  • [sql] [feature] 在sqlalchemy.sql命名空间中添加了“false()”和“true()”表达式结构,尽管不是__all__的一部分。

  • [sql] [feature] Dialect-specific compilers now raise CompileError for all type/statement compilation issues, instead of InvalidRequestError or ArgumentError. CREATE TABLE的DDL将重新引发CompileError以包含有问题列的表/列信息。

    参考文献:#2361

  • [sql] [bug] Improved the API for add_column() such that if the same column is added to its own table, an error is not raised and the constraints don’t get doubled up. 还有一些反射/声明模式。

    参考文献:#2356

  • [sql] [bug] Fixed issue where the “required” exception would not be raised for bindparam() with required=True, if the statement were given no parameters at all.

    参考文献:#2381

MySQL的¶ T0>

  • [mysql] [bug] 修正了regexp,它可以滤除未反映的“PARTITION”指令的警告,这要归功于George Reilly

    参考文献:#2376

源码¶ T0>

  • [sqlite] [bug] the “name” of an FK constraint in SQLite is reflected as “None”, not “0” or other integer value. 在任何情况下,SQLite似乎都不支持约束命名。

    参考文献:#2364

  • [sqlite] [bug] sql.false() and sql.true() compile to 0 and 1, respectively in sqlite

    参考文献:#2368

  • [sqlite] [bug] removed an erroneous “raise” in the SQLite dialect when getting table names and view names, where logic is in place to fall back to an older version of SQLite that doesn’t have the “sqlite_temp_master” table.

MSSQL ¶ T0>

  • [mssql] [bug] Adjusted the regexp used in the mssql.TIME type to ensure only six digits are received for the “microseconds” portion of the value, which is expected by Python’s datetime.time(). 请注意,对于发送微秒的支持至少在pyodbc中似乎还没有可能。

    参考文献:#2340

  • [mssql] [bug] 基于pymssql上的“30个字符”限制,根据报告说它现在做的更好。pymssql没有得到很好的测试,并且由于DBAPI处于不断变化之中,目前还不清楚该驱动程序的状态以及SQLAlchemy的实现应如何适应。

    参考文献:#2347

预言¶ T0>

  • [oracle] [bug] 将ORA-03135添加到oracle“连接丢失”错误永不停止的列表中

    参考文献:#2388

杂项¶ T0>

  • [feature] [examples] 简化版本示例,使用声明性混合以及事件侦听器,而不是元类+ SessionExtension。

    参考文献:#2313

  • [bug] [core] Changed LRUCache, used by the mapper to cache INSERT/UPDATE/DELETE statements, to use an incrementing counter instead of a timestamp to track entries, for greater reliability versus using time.time(), which can cause test failures on some platforms.

    参考文献:#2379

  • [bug] [core] Added a boolean check for the “finalize” function within the pool connection proxy’s weakref callback before calling it, so that a warning isn’t emitted that this function is None when the application is exiting and gc has removed the function from the module before the weakref callback was invoked.

    参考文献:#2383

  • [bug] [py3k] Fixed inappropriate usage of util.py3k flag and renamed it to util.py3k_warning, since this flag is intended to detect the -3 flag series of import restrictions only.

    参考文献:#2348

  • [bug] [examples] 修正large_collection.py在删除表之前关闭会话。

    参考文献:#2346

0.7.4 ¶ T0>

发布时间:2011年12月9日星期五

ORM ¶ T0>

  • [orm] [feature] polymorphic_on现在接受许多新的值:

    • 未映射的独立表达式
    • column_property()对象
    • 任何column_property()的字符串名称或映射列的属性名称

    该文档包含一个使用case()构造的示例,这可能是此处使用的常见构造。和部分

    polymorphic_on中的独立表达式传播到单表继承子类,以便它们在WHERE / JOIN子句中使用,以便像往常一样将行限制到该子类。

    参考文献:#2345#2238

  • [orm] [feature] 在处理Session.dirty等时,IdentitySet支持 - 操作符与difference()相同。

    参考文献:#2301

  • [orm] [feature] Added new value for Column autoincrement called “ignore_fk”, can be used to force autoincrement on a column that’s still part of a ForeignKeyConstraint. 关系文档中的新示例说明了它的用法。

  • [orm] [bug] Fixed backref behavior when “popping” the value off of a many-to-one in response to a removal from a stale one-to-many - the operation is skipped, since the many-to-one has since been updated.

    参考文献:#2315

  • [orm] [bug] After some years of not doing this, added more granularity to the “is X a parent of Y” functionality, which is used when determining if the FK on “Y” needs to be “nulled out” as well as if “Y” should be deleted with delete-orphan cascade. 现在测试考虑了父母的Python身份及其身份密钥,以查看Y的最后已知父母是否肯定是X.如果无法做出决定,则会引发StaleDataError。出现此错误的条件相当罕见,要求先前的父项已被垃圾收集,并且以前可能会非常不恰当地更新/删除自从迁移到新父项后的记录,但可能会出现某些情况,即“无声成功”之前发生的这种情况将在模糊不清的情况下出现。到期“Y”会重置“父”跟踪器,这意味着即使X过时,X.remove(Y)也可能会删除Y,但这与之前的行为相同;建议在这种情况下过期X.

    参考文献:#2264

  • [orm] [bug] 修复了query.get()中布尔上下文中用户映射对象的不恰当评估。也在0.6.9.

    参考文献:#2310

  • [orm] [bug] 将缺少的逗号添加到PASSIVE_RETURN_NEVER_SET符号

    参考文献:#2304

  • [orm] [bug] Cls.column.collat​​e(“some collat​​ion”)现在可用。也在0.6.9

    参考文献:#1776

  • [orm] [bug] the value of a composite attribute is now expired after an insert or update operation, instead of regenerated in place. 这可确保在使用该值重新生成组合值之前,将先载入在刷新内过期的列值。

    参考文献:#2309

  • [orm] [bug] The fix in also emits the “refresh” event when the composite value is loaded on access, even if all column values were already present, as is appropriate. 这修正了依赖于“加载”事件的“可变”扩展,以确保_parents字典是最新的修复。感谢Scott Torborg在这里的测试案例。

    参考文献:#2309#2308

  • [orm] [bug] Fixed bug whereby a subclass of a subclass using concrete inheritance in conjunction with the new ConcreteBase or AbstractConcreteBase would fail to apply the subclasses deeper than one level to the “polymorphic loader” of each base

    参考文献:#2312

  • [orm] [bug] Fixed bug whereby a subclass of a subclass using the new AbstractConcreteBase would fail to acquire the correct “base_mapper” attribute when the “base” mapper was generated, thereby causing failures later on.

    参考文献:#2312

  • [orm] [bug] Fixed bug whereby column_property() created against ORM-level column could be treated as a distinct entity when producing certain kinds of joined-inh joins.

    参考文献:#2316

  • [orm] [bug] 修复了元组无意中传递给session.query()时引发的错误格式。也在0.6.9.

    参考文献:#2297

  • [orm] [bug] 现在跟踪调用query.join()到单表继承子类,并用于消除额外的WHERE ..IN标准通常使用单表继承,因为联接应该适应它。这允许OUTER JOIN生成正确的结果,并且在处理单个表继承连接时总体上会产生更少的WHERE标准。

    参考文献:#2328

  • [orm] [bug] __ table_args__现在可以作为空元组以及空字典传递。感谢Fayaz Yusuf Khan提供的补丁。

    参考文献:#2339

  • [orm] [bug] Updated warning message when setting delete-orphan without delete to no longer refer to 0.6, as we never got around to upgrading this to an exception. 理想情况下,这可能会更好,但这并不是关键。

    参考文献:#2325

  • [orm] [bug] 修复了get_history()引用没有值的复合属性时的错误;为get_history()添加了关于复合的覆盖范围,否则这只是一个userland函数。

发动机¶ T0>

  • [engine] [bug] Fixed bug whereby transaction.rollback() would throw an error on an invalidated connection if the transaction were a two-phase or savepoint transaction. 对于普通事务来说,如果连接失效,rollback()是无操作的,所以虽然它不是100%清楚它是否应该是无操作,至少现在该接口是一致的。 T0>

    参考文献:#2317

SQL ¶ T0>

  • [sql] [feature] The update() construct can now accommodate multiple tables in the WHERE clause, which will render an “UPDATE..FROM” construct, recognized by Postgresql and MSSQL. 在MySQL上编译时,将会生成“UPDATE t1,t2,..”。如果Column对象用作“values”参数或生成方法中的键,则MySQL还可以在SET子句中针对多个表进行渲染。

    参考文献:#2166#1944

  • [sql] [feature] 对称为“python_type”的类型添加访问器,返回特定TypeEngine实例的基本Python类型对象(如果已知),否则引发NotImplementedError

    参考文献:#77

  • [sql] [bug] related to, made some adjustments to the change from regarding the “from” list on a select(). _froms集合不再被记忆,因为这简化了各种用例,并且在列已经在表达式中使用之后将列附加到表上时,不需要“警告” - select()构造现在将始终生成正确的表达。这里可能没有真实世界的性能。 select()对象几乎总是临时创建的,希望优化select()的重用的系统将使用“compiled_cache”特性。调用select.bind时发生的命中已经减少,但绝大多数用户不应该使用“绑定元数据”:)。

    参考文献:#2316#2261

  • [sql] [bug] further tweak to the fix from, so that generative methods work a bit better off of cloned (this is almost a non-use case though). 特别是,这允许with_only_columns()表现得更加一致。向with_only_columns()添加了额外的文档,以阐明预期的行为,这些行为由于。

    参考文献:#2261#2319

架构¶ T0>

  • [schema] [feature] 增加了对远程“模式”的新支持:

  • [schema] [feature] The “extend_existing” flag on Table now allows for the reflection process to take effect for a Table object that’s already been defined; when autoload=True and extend_existing=True are both set, the full set of columns will be reflected from the Table which will then overwrite those columns already present, rather than no activity occurring. 然而,直接存在于自动载入运行中的列将一如既往地使用。

    参考文献:#1410

  • [schema] [bug] Fixed bug whereby TypeDecorator would return a stale value for _type_affinity, when using a TypeDecorator that “switches” types, like the CHAR/UUID type.

  • [schema] [bug] Fixed bug whereby “order_by=’foreign_key’” option to Inspector.get_table_names wasn’t implementing the sort properly, replaced with the existing sort algorithm

  • [schema] [bug] the “name” of a column-level CHECK constraint, if present, is now rendered in the CREATE TABLE statement using “CONSTRAINT CHECK ”.

    参考文献:#2305

  • [schema] MetaData() accepts “schema” and “quote_schema” arguments, which will be applied to the same-named arguments of a Table or Sequence which leaves these at their default of None.

  • [schema] Sequence接受“quote_schema”参数

  • [schema] tometadata() for Table will use the “schema” of the incoming MetaData for the new Table if the schema argument is explicitly “None”

  • [schema] 添加了CreateSchema和DropSchema DDL结构 - 它们只接受模式的字符串名称和“quote”标志。

  • [schema] When using default “schema” with MetaData, ForeignKey will also assume the “default” schema when locating remote table. 这允许元数据上的“模式”参数应用于任何其他没有“模式”的表对象集合。

  • [schema] 方言中实现了“has_schema”方法,但仅适用于Postgresql。礼貌Manlio Perillo。

    参考文献:#1679

的PostgreSQL ¶ T0>

  • [postgresql] [feature] 向pg.ENUM添加了create_type构造函数参数。如果为False,则不会执行CREATE / DROP或检查该类型作为表创建/删除事件的一部分;只有直接调用的create()/ drop)()方法才能做到这一点。帮助Alembic“离线”脚本。

  • [postgresql] [bug] Postgresql方言记住在创建/删除序列期间处理了特定名称的ENUM。这允许创建/删除序列在没有任何对“checkfirst”的调用的情况下工作,并且也意味着打开“checkfirst”它只需要检查ENUM一次。

    参考文献:#2311

MySQL的¶ T0>

  • [mysql] [bug] Unicode调整允许最新的pymysql(post 0.4)在Python 2上传递100%。

MSSQL ¶ T0>

  • [mssql] [feature] 解除了SQL Server的SAVEPOINT限制。所有测试都通过使用它,但不知道是否有更深层的问题。

    参考文献:#822

  • [mssql] [bug] repaired the with_hint() feature which wasn’t implemented correctly on MSSQL - usually used for the “WITH (NOLOCK)” hint (which you shouldn’t be using anyway ! 改为使用快照隔离:))

    参考文献:#2336

  • [mssql] [bug] 对_need_decimal_fix选项使用新的pyodbc版本检测。

    参考文献:#2318

  • [mssql] [bug] 不要在SQL Server 2000上将“表名”转换为NVARCHAR。然而,大多数情况下,黑暗中需要什么咒语才能使PyODBC在FreeTDS 0.91中完全工作。然而,

    参考文献:#2343

  • [mssql] [bug] 在检索索引名称列表和索引内的列名称时解码传入值。

    参考文献:#2269

杂项¶ T0>

  • [feature] [ext] 为“变换器”的混合文档添加了一个示例 - 这是一种混合程序,它将自定义比较器与查询变换可调用结合起来。在调用with_transformation()的Query上使用新方法。这里的用例是相当实验性的,但仅向Query添加一行代码。

  • [bug] [pyodbc] pyodbc-based dialects now parse the pyodbc accurately as far as observed pyodbc strings, including such gems as “py3-3.0.1-beta4”

    参考文献:#2318

  • [bug] [ext] 当没有“default”编译处理程序而不是KeyError时,@compiles修饰器会引发一条信息错误消息。

  • [bug] [examples] Fixed bug in history_meta.py example where the “unique” flag was not removed from a single-table-inheritance subclass which generates columns to put up onto the base.

0.7.3 ¶ T0>

发布日期:2011年10月16日

一般¶ T0>

  • [general] Adjusted the “importlater” mechanism, which is used internally to resolve import cycles, such that the usage of __import__ is completed when the import of sqlalchemy or sqlalchemy.orm is done, thereby avoiding any usage of __import__ after the application starts new threads, fixes. 也在0.6.9.

    参考文献:#2279

ORM ¶ T0>

  • [orm] Improved query.join() such that the “left” side can more flexibly be a non-ORM selectable, such as a subquery. select_from()中的一个可选项现在将用作左侧,偏向于隐式使用映射实体。如果由于缺少外键而导致加入仍然失败,则错误消息包含此详细信息。感谢IRC上的brianrhude作为测试用例。

    参考文献:#2298

  • [orm] 添加after_soft_rollback()会话事件。无论何时发生实际的DBAPI级别回滚,每当调用rollback()时都会无条件触发此事件。此事件专门设计用于在Session.is_active为True时允许Session进行操作。

    参考文献:#2241

  • [orm] 在orm.aliased()构造中添加了“adapt_on_names”布尔标志。如果名称与实体映射列的名称相同,允许别名()构造将ORM实体链接到包含特定属性的聚合或其他派生形式的可选项。

  • [orm] Added new flag expire_on_flush=False to column_property(), marks those properties that would otherwise be considered to be “readonly”, i.e. derived from SQL expressions, to retain their value after a flush has occurred, including if the parent object itself was involved in an update.

  • [orm] Enhanced the instrumentation in the ORM to support Py3K’s new argument style of “required kw arguments”, i.e. fn(a, b, *, c, d), fn(a, b, *args, c, d). 映射对象的__init__方法的参数签名将被保留,包括所需的kw规则。

    参考文献:#2237

  • [orm] Fixed bug in unit of work whereby detection of “cycles” among classes in highly interlinked patterns would not produce a deterministic result; thereby sometimes missing some nodes that should be considered cycles and causing further issues down the road. 注意这个bug也是0.6;目前不支持。

    参考文献:#2282

  • [orm] 修复了从0.6开始的各种同义词()相关的回归:

    • 对同义词做同义词现在起作用。
    • 针对关系()的同义词可以传递给query.join(),发送给query.options()的选项通过名称传递给query.with_parent()。

  • [orm] Fixed bug whereby mapper.order_by attribute would be ignored in the “inner” query within a subquery eager load. . 也在0.6.9.

    参考文献:#2287

  • [orm] 身份映射.discard()在内部使用dict.pop(,None)而不是“del”来避免在非确定性gc拆卸期间出现KeyError / warning

    参考文献:#2267

  • [orm] 修正了新复合重写中的回归,其中由于缺少导入,deferred = True选项失败

    参考文献:#2253

  • [orm] 复制了“comparator_factory”参数到composite(),当0.7被释放时被移除。

    参考文献:#2248

  • [orm] Fixed bug in query.join() which would occur in a complex multiple-overlapping path scenario, where the same table could be joined to twice. Thanks much to Dave Vitek for the excellent fix here.

    参考文献:#2247

  • [orm] 当切片为None时,查询会将OFFSET转换为零,以便不调用无用的OFFSET子句。

  • [orm] 修复了边界情况,当新映射器上的关系会在第一个映射器上建立backref时,映射器无法完全更新内部状态。

  • [orm] Fixed bug whereby if __eq__() was redefined, a relationship many-to-one lazyload would hit the __eq__() and fail. 不适用于0.6.9.

    参考文献:#2260

  • [orm] Calling class_mapper() and passing in an object that is not a “type” (i.e. a class that could potentially be mapped) now raises an informative ArgumentError, rather than UnmappedClassError.

    参考文献:#2196

  • [orm] 新的事件挂钩MapperEvents.after_configured()。在configure()步骤完成并且映射器实际上受到影响后调用。从理论上讲,这个事件在每个应用程序中被调用一次,除非在已经使用现有的映射之后构造新的映射。

  • 当一个打开的会话被垃圾回收时,当它们被添加到一个新的会话中时,它所保留的对象将被视为再次被分离出来。[orm] 这是通过额外的检查来完成的,即前一个“session_key”实际上并不存在于会话池中。

    参考文献:#2281

  • [orm] 新的声明性功能:

    • __declare_last __()方法为类方法建立事件侦听器,当映射器通过最后的“configure”步骤完成时将调用该方法。
    • __abstract__标志。当这个标记出现在这个类上时,这个类将不会被映射。
    • 新的帮助类ConcreteBase,AbstractConcreteBase。允许使用声明的具体映射,当调用“configure”映射器步骤时,声明会自动设置“polymorphic_union”。
    • 映射器本身具有半私有方法,允许在配置完成后将“with_polymorphic”分配给映射器。

    参考文献:#2239

  • [orm] Declarative will warn when a subclass’ base uses @declared_attr for a regular column - this attribute does not propagate to subclasses.

    参考文献:#2283

  • [orm] The integer “id” used to link a mapped instance with its owning Session is now generated by a sequence generation function rather than id(Session), to eliminate the possibility of recycled id() values causing an incorrect result, no need to check that object actually in the session.

    参考文献:#2280

  • [orm] Behavioral improvement: empty conjunctions such as and_() and or_() will be flattened in the context of an enclosing conjunction, i.e. and_(x, or_()) will produce ‘X’ and not ‘X AND ()’..

    参考文献:#2257

  • [orm] 修复了关于计算select()元素的“from”列表的错误。“from”calc现在被延迟,因此如果构造使用尚未附加到表的对象,但稍后与表关联,则它将使用该表作为FROM生成SQL。这种变化深刻影响了FROM列表以及“相关”集合的计算机制,因为一些“子句自适应”方案(这些在ORM中使用非常严重)依赖于这样一个事实,即“froms”通常在适应完成之前缓存集合。返工允许它可以随时清除和重新生成“froms”集合。

    参考文献:#2261

  • [orm] Fixed bug whereby with_only_columns() method of Select would fail if a selectable were passed.. Also in 0.6.9.

    参考文献:#2270

发动机¶ T0>

  • [engine] The recreate() method in all pool classes uses self.__class__ to get at the type of pool to produce, in the case of subclassing. 请注意,通常不需要继承池的子类。

    参考文献:#2254

  • [engine] Improvement to multi-param statement logging, long lists of bound parameter sets will be compressed with an informative indicator of the compression taking place. 异常消息使用相同的改进格式。

    参考文献:#2243

  • [engine] 为pool.manage(dbapi).connect()添加了可选的“sa_pool_key”参数,以便不需要序列化args

  • [engine] The entry point resolution supported by create_engine() now supports resolution of individual DBAPI drivers on top of a built-in or entry point-resolved dialect, using the standard ‘+’ notation - it’s converted to a ‘.’ before being resolved as an entry point.

    参考文献:#2286

  • [engine] 为连接中的“return unicode detection”步骤添加了一个异常catch +警告,允许在NVARCHAR上崩溃的数据库继续初始化,假设没有实现NVARCHAR类型。¶ t2 >

    参考文献:#2299

架构¶ T0>

  • 修改Column.copy()以使用_constructor(),默认为self .__ class__,以便创建新对象。[schema] 这允许更容易支持Column的子类。

    参考文献:#2284

  • [schema] Added a slightly nicer __repr__() to SchemaItem classes. 注意这里的repr不能完全支持“repr是构造函数”的想法,因为模式项可以是非常深的嵌套/循环的,有些事情的后期初始化等等。

    参考文献:#2223

的PostgreSQL ¶ T0>

  • [postgresql] 为Index()添加了“postgresql_using”参数,产生USING子句来指定PG的索引实现。. 感谢Ryan P. Kelly的补丁。

    参考文献:#2290

  • [postgresql] 在使用postgresql + psycopg2方言时,向create_engine()添加了client_encoding参数;使用连接时的值调用psycopg2 set_client_encoding()方法。

    参考文献:#1839

  • [postgresql] Fixed bug related to whereby the same modified index behavior in PG 9 affected primary key reflection on a renamed column.. Also in 0.6.9.

    参考文献:#2291#2141

  • [postgresql] Table,Sequence的反射函数不再区分大小写。姓名只能在不同的情况下才会有所不同,并且会被正确区分。

    参考文献:#2256

  • [postgresql] 使用原子计数器作为服务器端游标名称的“随机数”来源;在极少数情况下报道了冲突。

  • [postgresql] 缩小了在当前搜索路径中反映具有模式的外键引用表时所做的假设;一个显式的模式只有在它实际上与引用表相匹配的时候才会被应用到引用表中,该引用表也有一个明确的模式。以前它假定“当前”模式与完整的search_path是同义词。

    参考文献:#2249

MySQL的¶ T0>

  • [mysql] CREATE TABLE会将COLLATE选项放在CHARSET之后,这似乎是MySQL的任意规则的一部分,关于它是否实际工作。也在0.6.9.

    参考文献:#2225

  • [mysql] 为Index构造添加了mysql_length参数,为索引指定了“length”。

    参考文献:#2293

源码¶ T0>

  • [sqlite] 确保从数据库中解析出的非法日期/时间/日期时间字符串引发相同的ValueError,无论C扩展名是否正在使用。

MSSQL ¶ T0>

  • [mssql] 更改为尝试使用Pyodbc支持FreeTDS 0.91。这包括当检测到FreeTDS 0.91时字符串绑定以Python unicode对象的形式发送,并且CAST(?AS NVARCHAR)用于检测表格时。然而,我仍然将Pyodbc + FreeTDS 0.91行为描述为非常糟糕,但仍有许多查询(如用于反射的查询,这些查询会在Linux上导致核心转储),而且在OSX上它根本不可用,MemoryErrors比比皆是,只是简单的破解unicode支持。

    参考文献:#2273

  • [mssql] The behavior of =/!= when comparing a scalar select to a value will no longer produce IN/NOT IN as of 0.8; this behavior is a little too heavy handed (use in_() if you want to emit IN) and now emits a deprecation warning. 要立即获得0.8行为并移除警告,可在http://www.sqlalchemy.org/docs/07/dialects_mssql.html#scalar-select-comparisons处提供编译器配方以覆盖visit_binary()的行为。

    参考文献:#2277

  • [mssql] “0”被接受为limit()的参数,它将产生“TOP 0”。

    参考文献:#2222

预言¶ T0>

  • [oracle] 固定用于zxjdbc方言的ReturningResultProxy ..从0.6开始回归。

    参考文献:#2272

  • [oracle] 字符串类型现在在Oracle上生成VARCHAR2,建议将其作为默认VARCHAR。也为Oracle方言添加了显式的VARCHAR2和NVARCHAR2。使用NVARCHAR仍会生成“NVARCHAR2” - Oracle上不存在“NVARCHAR” - 这仍然是“大写字母总是正好给出该”策略的轻微破坏。VARCHAR仍然会根据策略生成“VARCHAR”。如果Oracle将“VARCHAR”定义为他们声称的不同的东西(恕我直言,这种情况永远不会发生),那么类型将可用。

    参考文献:#2252

杂项¶ T0>

  • [types] 超出“precision”和“asdecimal”的浮点类型将被忽略;在此添加弃用警告以及与相关的其他文档

    参考文献:#2258

  • [ext] SQLSoup不会包含在SQLAlchemy的0.8版中;虽然有用,但我们希望保持SQLAlchemy本身专注于一个ORM使用范例。SQLSoup有望很快被第三方项目取代。

    参考文献:#2262

  • [ext] 向AssociationProxy添加了local_attr,remote_attr,attr访问器,可以在类级别快速访问代理属性。

    参考文献:#2236

  • [ext] Changed the update() method on association proxy dictionary to use a duck typing approach, i.e. checks for “keys”, to discern between update({}) and update((a, b)). 以前,传递一个有元组作为键的字典会被误解为一个序列。

    参考文献:#2275

  • [examples] 调整dictlike-polymorphic.py示例以应用CAST,使其可以在PG,其他数据库上运行。也在0.6.9.

    参考文献:#2266

0.7.2 ¶ T0>

发布于:2011年7月31日

ORM ¶ T0>

  • [orm] Feature enhancement: joined and subquery loading will now traverse already-present related objects and collections in search of unpopulated attributes throughout the scope of the eager load being defined, so that the eager loading that is specified via mappings or query options unconditionally takes place for the full depth, populating whatever is not already populated. 以前,如果相关的对象或集合已经存在导致不一致的行为(尽管可以节省已加载图形的加载/周期),则此遍历将停止。对于子查询,这意味着子查询发出的附加SELECT语句将无条件地调用,无论现有图的多少已经存在(因此存在争议)。当查询是属性启动的lazyload的结果时,“停止”的先前行为仍然有效,否则当重复遇到相同的相关对象时,“N + 1”风格的集合迭代可能变得不必要地昂贵。还有一个尚未公开的生成查询方法_with_invoke_all_eagers(),它选择旧/新行为

    参考文献:#2213

  • [orm] A rework of “replacement traversal” within the ORM as it alters selectables to be against aliases of things (i.e. clause adaption) includes a fix for multiply-nested any()/has() constructs against a joined table structure.

    参考文献:#2195

  • [orm] Fixed bug where query.join() + aliased=True from a joined-inh structure to itself on relationship() with join condition on the child table would convert the lead entity into the joined one inappropriately. 也在0.6.9.

    参考文献:#2234

  • [orm] Fixed regression from 0.6 where Session.add() against an object which contained None in a collection would raise an internal exception. 恢复到0.6的行为,即接受None,但显然没有任何东西被持续。理想情况下,带有None或append()的集合至少应该发出一个警告,该警告被认为是0.8.

    参考文献:#2205

  • [orm] 在无法定位行的对象上加载deferred()属性会引发ObjectDeletedError,而不是稍后失败;改进了ObjectDeletedError中的消息以包含除简单“删除”以外的其他条件。

    参考文献:#2191

  • [orm] Fixed regression from 0.6 where a get history operation on some relationship() based attributes would fail when a lazyload would emit; this could trigger within a flush() under certain conditions. 感谢为此提交了良好测试的用户。

    参考文献:#2224

  • [orm] Fixed bug apparent only in Python 3 whereby sorting of persistent + pending objects during flush would produce an illegal comparison, if the persistent object primary key is not a single integer. 也在0.6.9

    参考文献:#2228

  • [orm] Fixed bug whereby the source clause used by query.join() would be inconsistent if against a column expression that combined multiple entities together. 也在0.6.9

    参考文献:#2197

  • [orm] Fixed bug whereby if a mapped class redefined __hash__() or __eq__() to something non-standard, which is a supported use case as SQLA should never consult these, the methods would be consulted if the class was part of a “composite” (i.e. non-single-entity) result set. 也在0.6.9.

    参考文献:#2215

  • [orm] Added public attribute ”.validators” to Mapper, an immutable dictionary view of all attributes that have been decorated with the @validates decorator. 礼貌Stefano Fontanelli

    参考文献:#2240

  • [orm] Fixed subtle bug that caused SQL to blow up if: column_property() against subquery + joinedload + LIMIT + order by the column property() occurred. . 也在0.6.9

    参考文献:#2188

  • [orm] with_parent产生的连接条件以及对父代使用“动态”关系时将生成唯一的bindparams,而不是错误地重复相同的bindparam。. 也在0.6.9.

    参考文献:#2207

  • [orm] 在接收到用户参数relationship.order_by,foreign_keys,remote_side等时使用的mapper.polymorphic_on中添加了相同的“仅列”检查。

  • [orm] Fixed bug whereby comparison of column expression to a Query() would not call as_scalar() on the underlying SELECT statement to produce a scalar subquery, in the way that occurs if you called it on Query().subquery().

    参考文献:#2190

  • [orm] 修正了由于在_decl_class_registry中不必要地查找名称而导致从相同名称的超类继承的类失败的声明性错误。

    参考文献:#2194

  • [orm] Repaired the “no statement condition” assertion in Query which would attempt to raise if a generative method were called after from_statement() were called.. Also in 0.6.9.

    参考文献:#2199

发动机¶ T0>

  • [engine] 如果commit()失败,Connection.begin()提供的上下文管理器将发出rollback(),而不仅仅是发生异常。

  • [engine] Use urllib.parse_qsl() in Python 2.6 and above, no deprecation warning about cgi.parse_qsl()

    参考文献:#1682

  • [engine] 添加了mixin类sqlalchemy.ext.DontWrapMixin。用户定义的这种类型的异常在语句执行的上下文中不会包含在StatementException中。

  • [engine] StatementException包装将在消息中显示原始的异常类。

  • [engine] Failures on connect which raise dbapi.Error will forward the error to dialect.is_disconnect() and set the “connection_invalidated” flag if the dialect knows this to be a potentially “retryable” condition. 目前只有Oracle ORA-01033被执行。

    参考文献:#2201

SQL ¶ T0>

  • [sql] Fixed two subtle bugs involving column correspondence in a selectable, one with the same labeled subquery repeated, the other when the label has been “grouped” and loses itself. 影响。¶ T0>

    参考文献:#2188

架构¶ T0>

  • [schema] 新特性:所有类型都有with_variant()方法。产生Variant()的一个实例,这是一种特殊的TypeDecorator,它将根据使用的方言选择不同类型的用法。

    参考文献:#2187

  • [schema] Added an informative error message when ForeignKeyConstraint refers to a column name in the parent that is not found. 也在0.6.9.

  • [schema] Fixed bug whereby adaptation of old append_ddl_listener() function was passing unexpected **kw through to the Table event. Table没有获取kws,0.6中的MetaData事件会得到“tables = somecollection”,这种行为被保留。

    参考文献:#2206

  • [schema] Fixed bug where “autoincrement” detection on Table would fail if the type had no “affinity” value, in particular this would occur when using the UUID example on the site that uses TypeEngine as the “impl”.

  • [schema] 为TypeEngine对象添加了一个改进的repr(),它将只显示构造函数参数,这些参数是位置或kwargs偏离默认的。

    参考文献:#2209

的PostgreSQL ¶ T0>

  • [postgresql] 为Index添加了新的“postgresql_ops”参数,允许为索引列指定PostgreSQL操作符类。Courtesy Filip Zyzniewski。

    参考文献:#2198

MySQL的¶ T0>

  • [mysql] 修正了OurSQL方言使用ANSI中性引用符号“'”作为XA命令而不是'“'。. 也在0.6.9.

    参考文献:#2186

源码¶ T0>

  • [sqlite] SQLite方言不再将反映的默认值的引号剥离,从而允许往返CREATE TABLE的工作。这与其他方言也是一致的,这些方言也保持默认的确切形式。

    参考文献:#2189

MSSQL ¶ T0>

  • [mssql] Adjusted the pyodbc dialect such that bound values are passed as bytes and not unicode if the “Easysoft” unix drivers are detected. 这与FreeTDS发生的行为相同。如果在某些情况下传递了Python unicodes,Easysoft似乎会发生segfault。

预言¶ T0>

  • [oracle] 添加ORA-00028断开代码,使用cx_oracle _Error.code获取代码。也在0.6.9.

    参考文献:#2200

  • [oracle] 添加了ORA-01033来断开连接代码,可以在连接事件中捕获代码。

    参考文献:#2201

  • [oracle] 修复了没有生成正确DDL的oracle.RAW类型。也在0.6.9.

    参考文献:#2220

  • [oracle] 将CURRENT添加到保留字列表中。也在0.6.9.

    参考文献:#2212

  • [oracle] Fixed bug in the mutable extension whereby if the same type were used twice in one mapping, the attributes beyond the first would not get instrumented.

  • [oracle] 修正了可变扩展中的错误,如果设置了None或非对应类型,则会引发错误。现在不接受任何将None分配给所有属性的值,非法值会引发ValueError。

杂项¶ T0>

  • [examples] 修复了示例/版本控制测试运行器,不依赖于SQLAlchemy测试库,nosetests必须从examples / versioning中运行,以避免setup.cfg打破它。¶ t2 >

  • [examples] 对示例/版本进行调整,以在多级继承情况下选择正确的外键

  • [examples] 修正属性shard的例子,以0.7风格正确调用绑定参数。

0.7.1 ¶ T0>

发布:2011年6月15日

一般¶ T0>

  • [general] 为Python bug 7511添加了一个解决方法,C扩展构建失败并未在Windows 64位+ VC express上引发适当的异常

    参考文献:#2184

ORM ¶ T0>

  • [orm] “delete-orphan” cascade is now allowed on self-referential relationships - this since SQLA 0.7 no longer enforces “parent with no child” at the ORM level; this check is left up to foreign key nullability. 有关

    参考文献:#1912

  • [orm] 修复了新的“可变”扩展以正确地将事件传播给子类;不要为子类创建多个事件侦听器。

    参考文献:#2180

  • [orm] Modify the text of the message which occurs when the “identity” key isn’t detected on flush, to include the common cause that the Column isn’t set up to detect auto-increment correctly;. 也在0.6.8.

    参考文献:#2170

  • [orm] Fixed bug where transaction-level “deleted” collection wouldn’t be cleared of expunged states, raising an error if they later became transient. 也在0.6.8.

    参考文献:#2182

发动机¶ T0>

  • [engine] Deprecate schema/SQL-oriented methods on Connection/Engine that were never well known and are redundant: reflecttable(), create(), drop(), text(), engine.func

  • [engine] Adjusted the __contains__() method of a RowProxy result row such that no exception throw is generated internally; NoSuchColumnError() also will generate its message regardless of whether or not the column construct can be coerced to a string.. Also in 0.6.8.

    参考文献:#2178

SQL ¶ T0>

  • [sql] Fixed bug whereby metadata.reflect(bind) would close a Connection passed as a bind argument. 从0.6开始的回归。

  • [sql] 简化选择决定其'.c'集合中的内容的过程。除了传递给select([])的原始ClauseList()(它不是一个记录的案例)之外,它的行为是相同的,现在它将被扩展到它的各个列元素中,而不是被忽略。

的PostgreSQL ¶ T0>

  • [postgresql] 有关数值数组MATCH运算符的一些单元测试修正。一个潜在的浮点不准确问题已经修复,MATCH运算符的某些测试目前只能在面向EN的语言环境中执行。. 也在0.6.8.

    参考文献:#2175

MySQL的¶ T0>

  • [mysql] 单元测试在安装在windows上的MySQL上通过100%。

  • [mysql] 删除了在混合大小写名称的窗口上反映MySQL上的表时将失败的“调整大小写”步骤。在对Windows MySQL服务器进行了一些实验之后,已经确定这一步并没有真正帮助这种情况。 MySQL在非Windows平台上不会返回FK名称,并且删除该步骤至少可以让反射的行为更像其他操作系统。这里已经考虑过一个警告,但是它很难确定在什么情况下可以提出这样的警告,所以现在就这么说 - 增加了一些文档。

    参考文献:#2181

  • [mysql] supports_sane_rowcount will be set to False if using MySQLdb and the DBAPI doesn’t provide the constants.CLIENT module.

源码¶ T0>

  • [sqlite] Accept None from cursor.fetchone() when “PRAGMA read_uncommitted” is called to determine current isolation mode at connect time and default to SERIALIZABLE; this to support SQLite versions pre-3.3.0 that did not have this feature.

    参考文献:#2173

0.7.0 ¶ T0>

发布时间:2011年5月20日

ORM ¶ T0>

  • [orm] 固定回归在0.7b4(!)中引入由此query.options(someoption(“不存在的名称”))将不会引发错误。此外,还增加了额外的错误捕获功能,以便在该选项尝试构建基于列的元素时进一步修复某些在中定制的错误消息

    参考文献:#2069

  • [orm] query.count() emits “count(*)” instead of “count(1)”.

    参考文献:#2162

  • [orm] Fine tuning of Query clause adaptation when from_self(), union(), or other “select from myself” operation, such that plain SQL expression elements added to filter(), order_by() etc. which are present in the nested “from myself” query will be adapted in the same way an ORM expression element will, since these elements are otherwise not easily accessible.

    参考文献:#2155

  • [orm] Fixed bug where determination of “self referential” relationship would fail with no workaround for joined-inh subclass related to itself, or joined-inh subclass related to a subclass of that with no cols in the sub-sub class in the join condition. 也在0.6.8.

    参考文献:#2149

  • [orm] mapper() will ignore non-configured foreign keys to unrelated tables when determining inherit condition between parent and child class, but will raise as usual for unresolved columns and table names regarding the inherited table. 这是以前已经应用于声明的行为的增强泛化。0.6.8有一个更保守的版本,它并没有从根本上改变连接条件的确定方式。

    参考文献:#2153

  • [orm] 当给定实体不是单个完整的类实体或映射器(即列)时调用query.get()是错误的。这是0.6.8中的弃用警告。

    参考文献:#2144

  • [orm] Fixed a potential KeyError which under some circumstances could occur with the identity map, part of

    参考文献:#2148

  • [orm] 添加了Query.with_session()方法,将Query切换为使用不同的会话。

  • [orm] horizontal shard query should use execution options per connection as per

    参考文献:#2131

  • [orm] 非主映射器将继承主映射器的_identity_class。这样一来,针对通常在继承映射中的类建立的non_primary将生成与主映射器(也在0.6.8中)的身份映射兼容的结果

    参考文献:#2151

  • [orm] 修复了针对“无法为目标列q执行syncrule”发出的错误消息;映射器'X'不映射此列“以引用正确的映射器。. 也在0.6.8.

    参考文献:#2163

  • [orm] polymorphic_union() gets a “cast_nulls” option, disables the usage of CAST when it renders the labeled NULL columns.

    参考文献:#1502

  • [orm] polymorphic_union() renders the columns in their original table order, as according to the first table/selectable in the list of polymorphic unions in which they appear. (除非传递OrderedDict,否则它本身就是无序映射)。

  • [orm] Fixed bug whereby mapper mapped to an anonymous alias would fail if logging were used, due to unescaped % sign in the alias name. 也在0.6.8.

    参考文献:#2171

SQL ¶ T0>

  • [sql] Fixed bug whereby nesting a label of a select() with another label in it would produce incorrect exported columns. 除此之外,这会破坏另一个column_property()的ORM column_property()映射。. 也在0.6.8

    参考文献:#2167

  • [sql] 在确定连接条件时更改了处理,以便仅在两个给定表之间考虑外键错误。也就是说,t1.join(t2)将报告涉及't1'或't2'的FK错误,但涉及't3'的任何错误都将被跳过。这会影响join(),以及ORM关系和继承条件逻辑。

  • [sql] 当执行过程中的错误处理有一些改进时,确保自动关闭连接在出现异常DBAPI错误时真正关闭。

  • [sql] metadata.reflect()和reflection.Inspector()对GC的一些依赖关闭了内部获取的连接,并解决了这个问题。

  • [sql] 新增显式检查Column .name是否被指定为空字符串

    参考文献:#2140

  • [sql] Fixed bug whereby if FetchedValue was passed to column server_onupdate, it would not have its parent “column” assigned, added test coverage for all column default assignment patterns. 也在0.6.8

    参考文献:#2147

的PostgreSQL ¶ T0>

  • [postgresql] 修正psycopg2方言中的psycopg2_version解析。

  • [postgresql] 修正了影响PG9的错误,因此如果针对名称已更改的列,索引反射将失败。. 也在0.6.8.

    参考文献:#2141

MSSQL ¶ T0>

  • [mssql] Fixed bug in MSSQL dialect whereby the aliasing applied to a schema-qualified table would leak into enclosing select statements. 也在0.6.8.

    参考文献:#2169

杂项¶ T0>

  • 本节记录了从0.7b4到0.7.0的这些变化。对于什么SQLAlchemy的0.7的新功能的概述,请参阅 http://docs.sqlalchemy.org/en/latest/changelog_migration_07.html T0> ¶ T1>

  • [documentation] 从ext.mutable文档中删除了“collections.MutableMapping”abc的用法,因为它被错误地使用,并且使得该示例在任何情况下都更难以理解。¶< / T2>

    参考文献:#2152

  • [examples] removed the ancient “polymorphic association” examples and replaced with an updated set of examples that use declarative mixins, “generic_associations”. 每个提供一个替代表格布局。

  • [ext] 修复了sqlalchemy.ext.mutable扩展中的错误,其中None没有得到适当的处理,替换事件没有得到适当的处理。

    参考文献:#2143

0.7.0b4 ¶ T0>

发布日期:2011年4月17日

一般¶ T0>

  • [general] 更改此文件的CHANGES格式。格式更改已应用于0.7版本。

  • [general] 现在,“-claclarative”更改将直接列在“-orm”部分下,因为它们密切相关。

  • [general] 0.5系列更改已被移至替换CHANGES_PRE_05的文件CHANGES_PRE_06.

  • [general] 0.6系列中的0.6.7及更高版本的更新日志现在仅在0.6分支中的CHANGES文件中列出。在0.7的CHANGES文件(即这个文件)中,所有0.6的变化都在它们被应用的0.7节中内联列出(因为所有的0.6变化也都在0.7中)。注意适用于0.6版本的更改,如果存在实现/行为的任何差异。

ORM ¶ T0>

  • [orm] Some fixes to “evaluate” and “fetch” evaluation when query.update(), query.delete() are called. 记录的检索在所有情况下都是在自动刷新之后完成的,并且在发布更新/删除之前,防止未刷新的数据存在以及在评估期间过期的失败对象。

    参考文献:#2122

  • [orm] 重写了在尝试刷新非超类型的子类时发生的异常。

    参考文献:#2063

  • [orm] 当查询选项无法找到目标实体时,还会进行更多措辞调整。解释路径必须来自其中一个根实体。

  • [orm] Some fixes to the state handling regarding backrefs, typically when autoflush=False, where the back-referenced collection wouldn’t properly handle add/removes with no net change. 感谢Richard Murri提供的测试案例+补丁。(也在0.6.7)。

    参考文献:#2123

  • [orm] 在UOW中添加了检查,以检测被请求更新或删除包含NULL的主键值的异常情况。

    参考文献:#2127

  • [orm] 一些改进属性历史记录。在0.8版本中可能会有更多的更改,但是现在历史已经被修改,标量历史没有为非现值赋值None的“副作用”。这允许稍微更好地区分None集合和没有实际变化的能力,也影响到它们。

    参考文献:#2127

  • [orm] a “having” clause would be copied from the inside to the outside query if from_self() were used; in particular this would break an 0.7 style count() query. (也在0.6.7)

    参考文献:#2130

  • [orm] the Query.execution_options() method now passes those options to the Connection rather than the SELECT statement, so that all available options including isolation level and compiled cache may be used.

    参考文献:#2131

发动机¶ T0>

  • [engine] 如果CPython 2.x默认启用了C扩展,如果编译失败,它将回退到纯Python。

    参考文献:#2129

SQL ¶ T0>

  • [sql] 当传递给SELECT语句而不是Connection时,“compiled_cache”执行选项现在会引发错误。以前它被完全忽略。我们可能会考虑让这个选项在每个语句级别上工作。

    参考文献:#2131

  • [sql] 在基础TypeEngine类中还原了“catchall”构造函数,并带有弃用警告。这使得像Integer(11)这样的代码仍然成功。

  • [sql] Fixed regression whereby MetaData() coming back from unpickling did not keep track of new things it keeps track of now, i.e. collection of Sequence objects, list of schema names.

    参考文献:#2104

  • [sql] The limit/offset keywords to select() as well as the value passed to select.limit()/offset() will be coerced to integer. (也在0.6.7)

    参考文献:#2116

  • [sql] fixed bug where “from” clause gathering from an over() clause would be an itertools.chain() and not a list, causing “can only concatenate list” TypeError when combined with other clauses.

  • [sql] Fixed incorrect usage of ”,” in over() clause being placed between the “partition” and “order by” clauses.

    参考文献:#2134

  • [sql] 在为PrimaryKeyConstraint now函数附加事件之前/之后,为所有约束类型的事件之前/之后添加了测试。

    参考文献:#2105

  • [sql] Added explicit true()/false() constructs to expression lib - coercion rules will intercept “False”/”True” into these constructs. 在0.6中,构造通常直接转换为字符串,这在0.7中不再被接受。

    参考文献:#2117

架构¶ T0>

  • [schema] Table上的'useexisting'标志已被新的一对标志'keep_existing'和'extend_existing'取代。'extend_existing'相当于'useexisting' - 返回现有的表,并添加额外的构造函数元素。使用'keep_existing',将返回现有表,但不会添加其他构造函数元素 - 这些元素仅在新创建表时应用。

    参考文献:#2109

的PostgreSQL ¶ T0>

  • [postgresql] 现在支持Python 3的Psycopg2.

  • [postgresql] 固定支持使用pg8000时的精确数字。

    参考文献:#2132

源码¶ T0>

  • [sqlite] 修正了创建为“REFERENCES ”而没有列名的外键反映失败的问题。 T2>(也在0.6.7)

    参考文献:#2115

预言¶ T0>

  • [oracle] Using column names that would require quotes for the column itself or for a name-generated bind parameter, such as names with special characters, underscores, non-ascii characters, now properly translate bind parameter keys when talking to cx_oracle. (也在0.6.7)

    参考文献:#2100

  • [oracle] Oracle dialect adds use_binds_for_limits=False create_engine() flag, will render the LIMIT/OFFSET values inline instead of as binds, reported to modify the execution plan used by Oracle. (也在0.6.7)

    参考文献:#2116

杂项¶ T0>

  • [types] REAL已添加到核心类型。Postgresql,SQL Server,MySQL,SQLite支持。请注意,SQL Server和MySQL版本中增加了额外的参数,这些方言也可以使用。

    参考文献:#2081

  • [types] 添加@ event.listens_for()装饰器,给定目标+事件名称,将装饰函数作为侦听器应用。

    参考文献:#2106

  • 现在,AssertionPool存储回溯指示当前检出的连接被获取的位置; [pool] 此回溯报告在第二次并发结账时产生的断言中;礼貌Gunnlaugur Briem

    参考文献:#2103

  • [pool] The “pool.manage” feature doesn’t use pickle anymore to hash the arguments for each pool.

  • [documentation] 记录的SQLite日期/时间/日期时间类型。(也在0.6.7)

    参考文献:#2029

  • [documentation] 修复了可变扩展文档,以显示正确的类型关联方法。

    参考文献:#2118

0.7.0b3 ¶ T0>

发布日期:2011年3月20日

一般¶ T0>

  • [general] 在Pypy下运行时对单元测试有很多修正(礼貌Alex Gaynor)。

ORM ¶ T0>

  • [orm] 更改了query.count()的底层方法。query.count()现在在所有情况下都是精确的:

    查询。
    from_self(func.count(literal_column(“1”)))。标()

    即,“从()”选择计数(1)“。 T0>这会在所有情况下产生子查询,但大大简化了之前尝试执行的所有猜测count(),在许多情况下仍然会失败,特别是当涉及到表连接和其他连接时。如果为其他非常简单的计数生成的子查询确实是个问题,请使用query(func.count())作为优化。

    参考文献:#2093

  • [orm] 在迭代期间对罕见weakref回调的标识映射进行了一些更改。互斥体已被删除,因为它显然可能导致重入(即在一个线程中)死锁,也许当gc在迭代点收集对象以获得更多内存时。希望“迭代过程中字典发生变化”将非常罕见,因为迭代方法在内部获取单个values()调用中的完整对象列表。注意0.6.7在这里有一个更保守的修复,它仍然保持互斥体。

    参考文献:#2087

  • [orm] A tweak to the unit of work causes it to order the flush along relationship() dependencies even if the given objects don’t have any inter-attribute references in memory, which was the behavior in 0.5 and earlier, so a flush of Parent/Child with only foreign key/primary key set will succeed. 在保持0.6或更高版本的同时,这不会在flush中产生大量无用的内部依赖性结构,而这些内部依赖性结构并不对应于当前flush中实际的状态。

    参考文献:#2082

  • [orm] 改进了仅当使用加载器选项(通常不正确)查询仅列实体时出现的错误消息,其中父实体不完全存在。¶ t2 >

    参考文献:#2069

  • [orm] Fixed bug in query.options() whereby a path applied to a lazyload using string keys could overlap a same named attribute on the wrong entity. 注意0.6.7对此有一个更保守的解决方法。

    参考文献:#2098

发动机¶ T0>

  • [engine] 修正了AssertionPool回归bug。

    参考文献:#2097

  • [engine] 当指定了无效的方言时,将引发的异常更改为ArgumentError

    参考文献:#2060

SQL ¶ T0>

  • [sql] 添加了一个完全描述性的错误消息,其中Column是子类,_make_proxy()由于构造函数的TypeError而无法复制。在这种情况下,应该实现_constructor方法。

  • [sql] 为表对象添加了新事件“column_reflect”。在对象在反射中生成之前接收关于Column的信息字典,并允许修改字典以控制生成的Column的大部分方面,包括键,名称,类型,信息字典。

    参考文献:#2095

  • [sql] To help with the “column_reflect” event being used with specific Table objects instead of all instances of Table, listeners can be added to a Table object inline with its construction using a new argument “listeners”, a list of tuples of the form (, ), which are applied to the Table before the reflection process begins.

  • [sql] Added new generic function “next_value()”, accepts a Sequence object as its argument and renders the appropriate “next value” generation string on the target platform, if supported. 还在Sequence本身提供了“.next_value()”方法。

    参考文献:#2085

  • [sql] func.next_value() or other SQL expression can be embedded directly into an insert() construct, and if implicit or explicit “returning” is used in conjunction with a primary key column, the newly generated value will be present in result.inserted_primary_key.

    参考文献:#2084

  • [sql] 为ResultProxy添加访问器“returns_rows”,“is_insert”(也在0.6.7中)

    参考文献:#2089

的PostgreSQL ¶ T0>

  • [postgresql] 为postgresql方言添加了RESERVED_WORDS。(也在0.6.7)

    参考文献:#2092

  • [postgresql] 固定BIT类型以允许“长度”参数,“变化”参数。反思也是固定的。(也在0.6.7)

    参考文献:#2073

MSSQL ¶ T0>

  • [mssql] Rewrote the query used to get the definition of a view, typically when using the Inspector interface, to use sys.sql_modules instead of the information schema, thereby allowing views definitions longer than 4000 characters to be fully returned. (也在0.6.7)

    参考文献:#2071

火鸟¶ T0>

  • [firebird] 如果设置为False,create_engine()上的“implicit_returning”标志将被接受。(也在0.6.7)

    参考文献:#2083

杂项¶ T0>

  • [declarative] __mapper_args__中不是“可散列”的参数不会被误认为是可能存在的,可能列参数。(也在0.6.7)

    参考文献:#2091

  • [informix] 添加了RESERVED_WORDS informix方言。(也在0.6.7)

    参考文献:#2092

  • [ext] The horizontal_shard ShardedSession class accepts the common Session argument “query_cls” as a constructor argument, to enable further subclassing of ShardedQuery. (也在0.6.7)

    参考文献:#2090

  • [examples] 更新了关联,关联代理示例以使用声明式,添加了一个新例子dict_of_sets_with_default.py,这是一个“推送关联代理”的例子

  • [examples] 烧杯缓存示例允许query_callable()函数的“query_cls”参数。(也在0.6.7)

    参考文献:#2090

0.7.0b2 ¶ T0>

发布时间:2011年2月19日

ORM ¶ T0>

  • [orm] Fixed bug whereby Session.merge() would call the load() event with one too few arguments.

    参考文献:#2053

  • [orm] 添加了逻辑,用于防止MapperExtension或SessionExtension中的事件生成为未覆盖的所有方法生成不执行事件。

    参考文献:#2052

SQL ¶ T0>

  • [sql] 将EngineEvents事件类重命名为ConnectionEvents。由于这些类永远不会被最终用户代码直接访问,所以这严格地是对最终用户的文档更改。还简化了事件如何链接到内部的引擎和连接。

    参考文献:#2059

  • [sql] The Sequence() construct, when passed a MetaData() object via its ‘metadata’ argument, will be included in CREATE/DROP statements within metadata.create_all() and metadata.drop_all(), including “checkfirst” logic.

    参考文献:#2055

  • [sql] 如果Column.references()方法有一个外键完全引用给定列,而不仅仅是它的父表,则它返回True。

    参考文献:#2064

的PostgreSQL ¶ T0>

  • [postgresql] 修复了从0.6开始的回归,其中SMALLINT和BIGINT类型都会在整数PK列上生成SERIAL,而不是SMALLINT和BIGSERIAL

    参考文献:#2065

杂项¶ T0>

  • [declarative] 固定回归,其中带有内嵌列的对象的composite()将无法初始化。Column对象现在可以与composite()或外部内联,并通过名称或对象引用拉入。

    参考文献:#2058

  • [declarative] 修复引用旧的@classproperty名称引用@declared_attr(同样在0.6.7)的错误消息

    参考文献:#2061

  • [declarative] __table_args__元组结尾处的字典现在是可选的。

    参考文献:#1468

  • [ext] Association proxy now has correct behavior for any(), has(), and contains() when proxying a many-to-one scalar attribute to a one-to-many collection (i.e. the reverse of the ‘typical’ association proxy use case)

    参考文献:#2054

  • [examples] Beaker example now takes into account ‘limit’ and ‘offset’, bind params within embedded FROM clauses (like when you use union() or from_self()) when generating a cache key.

0.7.0b1 ¶ T0>

发布时间:2011年2月12日星期六

一般¶ T0>

  • [general] 新的事件系统,取代所有扩展名,侦听器等。

    参考文献:#1902

  • [general] 记录增强

    参考文献:#1926

  • [general] 安装程序不再安装鼻插件

    参考文献:#1949

  • [general] sys.modules中的“sqlalchemy.exceptions”别名已被删除。基本SQLA例外可通过“from sqlalchemy import exc”获得。“exc”的“例外”别名现在仍然保留在“sqlalchemy”中,它只是没有修补到sys.modules中。

ORM ¶ T0>

  • [orm] 更简洁的query.join形式(target,onclause)

    参考文献:#1923

  • [orm] 混合属性,implements / supersedes synonym()

    参考文献:#1903

  • [orm] 重写组合

    参考文献:#2008

  • [orm] 突变事件扩展,取代“mutable = True”

  • [orm] 默认关闭PickleType和ARRAY可变性

    参考文献:#1980

  • [orm] 简化的polymorphic_on赋值

    参考文献:#1895

  • [orm] 允许没有父母的孤儿进行冲洗

    参考文献:#1912

  • [orm] 在autocommit = True的情况下提交之前调整的刷新记帐步骤发生。这允许autocommit = True与expire_on_commit = True一起正常工作,并且还允许post-flush会话挂钩在与autocommit = False相同的事务上下文中操作。

    参考文献:#2041

  • [orm] 收集成员时产生的警告,标量指示不属于flush

    参考文献:#1973

  • [orm] - 衍生的结构可以映射

    参考文献:#1876

  • [orm] 查询改进中的元组标签名称

    参考文献:#1942

  • [orm] 映​​射列属性首先引用最具体的列

    参考文献:#1892

  • [orm] 映​​射到两个或多个同名列的连接需要显式声明

    参考文献:#1896

  • [orm] Mapper requires that polymorphic_on column be present in the mapped selectable

    参考文献:#1875

  • [orm] compile_mappers()重命名为configure_mappers(),简化了配置内部

    参考文献:#1966

  • [orm] the aliased() function, if passed a SQL FromClause element (i.e. not a mapped class), will return element.alias() instead of raising an error on AliasedClass.

    参考文献:#2018

  • [orm] Session.merge() will check the version id of the incoming state against that of the database, assuming the mapping uses version ids and incoming state has a version_id assigned, and raise StaleDataError if they don’t match.

    参考文献:#2027

  • [orm] Session.connection(),Session.execute()接受'bind',以允许执行/连接操作显式地参与引擎的打开事务。¶ t2 >

    参考文献:#1996

  • [orm] Query.join(), Query.outerjoin(), eagerload(), eagerload_all(), others no longer allow lists of attributes as arguments (i.e. option([x, y, z]) form, deprecated since 0.5)

  • [orm] 删除了ScopedSession.mapper(自0.5开始弃用)。

  • [orm] 水平分片查询将'shard_id'放置在context.attributes中,它可以通过“load()”事件访问。

    参考文献:#2031

  • [orm] 跨多个实体的单个contains_eager()调用将指示沿该路径加载的所有集合,而不是每个端点都要求不同的contains_eager()调用(这从未正确记录过)¶ T2>

    参考文献:#2032

  • [orm] The “name” field used in orm.aliased() now renders in the resulting SQL statement.

  • [orm] 会话weak_instance_dict = False已弃用。

    参考文献:#1473

  • [orm] 是0.6.6中的一个警告。

    参考文献:#2046

  • [orm] Query.distinct() now accepts column expressions as *args, interpreted by the Postgresql dialect as DISTINCT ON ().

    参考文献:#1069

  • [orm] Additional tuning to “many-to-one” relationship loads during a flush(). 版本0.6.6([ticket:2002])的更改要求在刷新期间可能会发生更多“不必要”的m2o加载。额外的加载模式已被添加,以便在这个特定用例中发出的SQL被修剪回来,同时仍然检索flush所需的信息以避免遗漏任何东西。

    参考文献:#2049

  • [orm] 传递给attributes.get_history()的“passive”的值应该是属性包中定义的常量之一。发送True或False不推荐使用。

  • [orm] Query.subquery()添加了名称参数,以允许将固定名称分配给别名对象。(也在0.6.7)

    参考文献:#2030

  • [orm] 当连接表继承映射程序在本地映射表上没有主键(但在超类表上有pks)时,会发出警告。(也在0.6.7)

    参考文献:#2019

  • [orm] Fixed bug where “middle” class in a polymorphic hierarchy would have no ‘polymorphic_on’ column if it didn’t also specify a ‘polymorphic_identity’, leading to strange errors upon refresh, wrong class loaded when querying from that target. 在使用单个表继承时也会发出正确的WHERE标准。(也在0.6.7)

    参考文献:#2038

  • [orm] Fixed bug where a column with a SQL or server side default that was excluded from a mapping with include_properties or exclude_properties would result in UnmappedColumnError. (也在0.6.7)

    参考文献:#1995

  • [orm] 在异常情况下发生警告,即在取消引用父对象后发生集合上的附加事件或类似事件,这会阻止父会话在会话中被标记为“脏” 。这在0.7中是个例外。(也在0.6.7)

    参考文献:#2046

SQL ¶ T0>

  • [sql] Added over() function, method to FunctionElement classes, produces the _Over() construct which in turn generates “window functions”, i.e. “ OVER (PARTITION BY , ORDER BY )”.

    参考文献:#1844

  • [sql] LIMIT / OFFSET子句现在使用绑定参数

    参考文献:#805

  • [sql] select.distinct() now accepts column expressions as *args, interpreted by the Postgresql dialect as DISTINCT ON (). 请注意,这已通过将列表传递给distinct关键字参数以用于select()。

    参考文献:#1069

  • [sql] select.prefix_with() accepts multiple expressions (i.e. *expr), ‘prefix’ keyword argument to select() accepts a list or tuple.

  • [sql] Passing a string to the distinct keyword argument of select() for the purpose of emitting special MySQL keywords (DISTINCTROW etc.) 已弃用 - 为此使用prefix_with()

  • [sql] TypeDecorator使用主键列

    参考文献:#2006#2005

  • [sql] DDL()构造现在转义百分号

    参考文献:#1897

  • [sql] Table.c / MetaData.tables refined a bit, don’t allow direct mutation

    参考文献:#1917#1893

  • [sql] 传递给bindparam()的callables不会被评估

    参考文献:#1950

  • [sql] types.type_map现在是private,types._type_map

    参考文献:#1870

  • [sql] 强调非公有池方法

    参考文献:#1982

  • [sql] 添加了NULLS FIRST和NULLS LAST支持。它作为asc()和desc()运算符的扩展实现,称为nullsfirst()和nullslast()。

    参考文献:#723

  • [sql] 可以使用字符串作为列名内联表创建Index()构造,作为在表外创建索引的替代方法。 T2>

  • [sql] execution_options() on Connection accepts “isolation_level” argument, sets transaction isolation level for that connection only until returned to the connection pool, for those backends which support it (SQLite, Postgresql)

    参考文献:#2001

  • [sql] A TypeDecorator of Integer can be used with a primary key column, and the “autoincrement” feature of various dialects as well as the “sqlite_autoincrement” flag will honor the underlying database type as being Integer-based.

    参考文献:#2005

  • [sql] 在Integer PK列上存在server_default时建立一致性。SQLA不会预取这些,也不会返回到cursor.lastrowid(DBAPI)中。确保所有后端在result.inserted_primary_key中始终返回无。关于这种情况的反思,除了在我们检测到序列默认值的PG SERIAL col的情况下,对server_default的int PK col的反映将“autoincrement”标志设置为False。

    References: #2020, #2021

  • [sql] Result-row processors are applied to pre-executed SQL defaults, as well as cursor.lastrowid, when determining the contents of result.inserted_primary_key.

    参考文献:#2006

  • [sql] Bind parameters present in the “columns clause” of a select are now auto-labeled like other “anonymous” clauses, which among other things allows their “type” to be meaningful when the row is fetched, as in result row processors.

  • [sql] TypeDecorator存在于“sqlalchemy”导入空间中。

  • [sql] Non-DBAPI errors which occur in the scope of an execute() call are now wrapped in sqlalchemy.exc.StatementError, and the text of the SQL statement and repr() of params is included. 这使得更容易识别在DBAPI涉及之前失败的语句执行。

    参考文献:#2015

  • [sql] The concept of associating a ”.bind” directly with a ClauseElement has been explicitly moved to Executable, i.e. the mixin that describes ClauseElements which represent engine-executable constructs. 这种改变是对内部组织的改进,不太可能影响任何实际使用。

    参考文献:#2048

  • [sql] Column.copy(), as used in table.tometadata(), copies the ‘doc’ attribute. (也在0.6.7)

    参考文献:#2028

  • [sql] Added some defs to the resultproxy.c extension so that the extension compiles and runs on Python 2.4. (也在0.6.7)

    参考文献:#2023

  • [sql] The compiler extension now supports overriding the default compilation of expression._BindParamClause including that the auto-generated binds within the VALUES/SET clause of an insert()/update() statement will also use the new compilation rules. (也在0.6.7)

    参考文献:#2042

  • [sql] SQLite dialect now uses NullPool for file-based databases

    参考文献:#1921

  • [sql] The path given as the location of a sqlite database is now normalized via os.path.abspath(), so that directory changes within the process don’t affect the ultimate location of a relative file path.

    参考文献:#2036

的PostgreSQL ¶ T0>

  • [postgresql] When explicit sequence execution derives the name of the auto-generated sequence of a SERIAL column, which currently only occurs if implicit_returning=False, now accommodates if the table + column name is greater than 63 characters using the same logic Postgresql uses. (也在0.6.7)

    参考文献:#1083

  • [postgresql] 在“disconnect”异常列表中添加了额外的libpq消息,“无法从服务器接收数据”(同样在0.6.7中)

    参考文献:#2044

MySQL的¶ T0>

  • [mysql] pymysql的新的DBAPI支持,它是MySQL-python的纯Python端口。

    参考文献:#1991

  • [mysql] oursql dialect accepts the same “ssl” arguments in create_engine() as that of MySQLdb. (也在0.6.7)

    参考文献:#2047

MSSQL ¶ T0>

  • [mssql] the String/Unicode types, and their counterparts VARCHAR/ NVARCHAR, emit “max” as the length when no length is specified, so that the default length, normally ‘1’ as per SQL server documentation, is instead ‘unbounded’. 对于VARBINARY类型也会发生这种情况。

    这种行为使得这些类型与Postgresql的VARCHAR类型更紧密的兼容,当没有指定长度时,它类似地是无界的。

    参考文献:#1833

火鸟¶ T0>

  • [firebird] 一些调整,以便支持Interbase。FB / Interbase版本标识符被分析为一个结构,例如(8,1,1,'interbase')或(2,1,588,'firebird'),因此可以区分它们。

    参考文献:#1885

杂项¶ T0>