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

SQLAlchemy 1.1文档

0.3更新日志

0.3.11 ¶ T0>

发布日期:2007年10月14日

ORM ¶ T0>

  • [orm] 沿着两个不同的m2m表添加了使用join()从A-> B进行连接的检查。这会在0.3中产生一个错误,但在使用别名时可能在0.4中。

    参考文献:#687

  • [orm] fixed small exception throw bug in Session.merge()

  • [orm] fixed bug where mapper, being linked to a join where one table had no PK columns, would not detect that the joined table had no PK.

  • [orm] 从自定义继承条件中确定合适的同步子句时修正了错误

    参考文献:#769

  • [orm] backref remove object operation doesn’t fail if the other-side collection doesn’t contain the item, supports noload collections

    参考文献:#813

发动机¶ T0>

  • [engine] 修正了当使用threadlocal设置池时可能发生的另一个偶然竞争条件

SQL ¶ T0>

  • [sql] tweak DISTINCT precedence for clauses like func.count(t.c.col.distinct())

  • [sql] Fixed detection of internal ‘$’ characters in :bind$params

    参考文献:#719

  • [sql] don’t assume join criterion consists only of column objects

    参考文献:#768

  • [sql] adjusted operator precedence of NOT to match ‘==’ and others, so that ~(x==y) produces NOT (x=y), which is compatible with MySQL < 5.0 (doesn’t like “NOT x=y”)

    参考文献:#764

MySQL的¶ T0>

  • [mysql] 生成模式时固定指定YEAR列

源码¶ T0>

  • [sqlite] passthrough字符串日期

MSSQL ¶ T0>

  • [mssql] 增加了对TIME列的支持(使用DATETIME进行模拟)

    参考文献:#679

  • [mssql] 增加了对BIGINT,MONEY,SMALLMONEY,UNIQUEIDENTIFIER和SQL_VARIANT的支持

    参考文献:#721

  • [mssql] index names are now quoted when dropping from reflected tables

    参考文献:#684

  • [mssql] can now specify a DSN for PyODBC, using a URI like mssql:///?dsn=bob

预言¶ T0>

  • [oracle] 从“binary”类型中删除了LONG_STRING,LONG_BINARY,所以类型对象不会尝试读取它们的值作为LOB。

    参考文献:#622#751

火鸟¶ T0>

  • [firebird] supports_sane_rowcount() set to False due to ticket #370 (right way).

  • [firebird] 固定反映Column的可空属性

杂项¶ T0>

  • 当反映来自其他模式的表时,置于主键(即通常为序列名称)上的“默认”具有无条件地引用的“模式”名称,以便需要引用的模式名称分别是[postgres] 精细。对于不需要引用但不会造成危害的模式名称而言,它是稍微不必要的。

0.3.10 ¶ T0>

发布时间:2007年7月20日

一般¶ T0>

  • [general] a new mutex that was added in 0.3.9 causes the pool_timeout feature to fail during a race condition; threads would raise TimeoutError immediately with no delay if many threads push the pool into overflow at the same time. 这个问题已经修复。

ORM ¶ T0>

  • [orm] cleanup to connection-bound sessions, SessionTransaction

SQL ¶ T0>

  • [sql] 获得连接绑定的元数据以隐式执行

  • [sql] foreign key specs can have any chararcter in their identifiers

    参考文献:#667

  • [sql] 将交换性意识添加到二进制子句比较中,改进了ORM延迟加载优化

    参考文献:#664

杂项¶ T0>

  • [postgres] 固定的最大标识符长度(63)

    参考文献:#571

0.3.9 ¶ T0>

发布日期:2007年7月15日

一般¶ T0>

  • [general] 更好的错误消息为NoSuchColumnError

    参考文献:#607

  • [general] 终于弄清楚了如何获取setuptools的版本,作为sqlalchemy .__ version __

    参考文献:#428

  • [general] the various “engine” arguments, such as “engine”, “connectable”, “engine_or_url”, “bind_to”, etc. 都存在,但不推荐使用。它们全部被单一术语“绑定”取代。您还可以使用metadata.bind = 设置元数据的“绑定”

ORM ¶ T0>

  • [orm] forwards-compatibility with 0.4: added one(), first(), and all() to Query. 几乎所有来自0.4的查询功能都出现在0.3.9中,用于向前兼容。

  • [orm] reset_joinpoint() really really works this time, promise ! lets you re-join from the root: query.join([‘a’, ‘b’]).filter().reset_joinpoint().join([‘a’, ‘c’]).filter().all() in 0.4 all join() calls start from the “root”

  • [orm] added synchronization to the mapper() construction step, to avoid thread collisions when pre-existing mappers are compiling in a different thread

    参考文献:#613

  • [orm] a warning is issued by Mapper when two primary key columns of the same name are munged into a single attribute. 当映射到连接(或继承)时,这经常发生。

  • [orm] synonym() properties are fully supported by all Query joining/ with_parent operations

    参考文献:#598

  • [orm] 用多对多的方式删除项目时修复了非常愚蠢的错误uselist =错误关系

  • [orm] remember all that stuff about polymorphic_union ? 用于连接表继承?有趣的事情...你不需要它连接表继承,你可以通过outerjoin()把所有的表连接在一起。The UNION still applies if concrete tables are involved, though (since nothing to join them on).

  • [orm] 小的修复程序,以便更好地使用正在使用直接“外连接”子句的多态映射器进行加载。

SQL ¶ T0>

  • [sql] ForeignKey to a table in a schema that’s not the default schema requires the schema to be explicit; i.e. ForeignKey(‘alt_schema.users.id’)

  • [sql] MetaData can now be constructed with an engine or url as the first argument, just like BoundMetaData

  • [sql] BoundMetaData is now deprecated, and MetaData is a direct substitute.

  • [sql] DynamicMetaData has been renamed to ThreadLocalMetaData. DynamicMetaData名称不推荐使用,并且是ThreadLocalMetaData的别名或者是一个常规的元数据if threadlocal = False

  • [sql] composite primary key is represented as a non-keyed set to allow for composite keys consisting of cols with the same name; occurs within a Join. 帮助继承场景制定正确的PK。

  • [sql] improved ability to get the “correct” and most minimal set of primary key columns from a join, equating foreign keys and otherwise equated columns. 这也主要是为了帮助继承场景制定主键列的最佳选择。

    参考文献:#185

  • [sql] 为Sequence.create()/ drop(),ColumnDefault.execute()添加了'bind'参数

  • [sql] 列可以在具有与列名称不同的“key”属性(包括主键列)的反映表中重写

    参考文献:#650

  • 当结果列表中存在dupe col名时,[sql] 修复了“ambiguous column”结果检测

    参考文献:#657

  • [sql] some enhancements to “column targeting”, the ability to match a column to a “corresponding” column in another selectable. 这主要影响到ORM映射到复杂连接的能力

  • [sql] MetaData and all SchemaItems are safe to use with pickle. 缓慢的桌面反射可以被转储到一个腌制的文件以后再使用。取出后,只需将引擎重新连接到元数据即可。

    参考文献:#619

  • [sql] added a mutex to QueuePool’s “overflow” calculation to prevent a race condition that can bypass max_overflow

  • [sql] fixed grouping of compound selects to give correct results. 会在某些情况下打破SQLite,但这些情况下产生不正确的结果无论如何,sqlite不支持分组复合选择

    参考文献:#623

  • [sql] 运算符的固定优先级,使括号正确应用

    参考文献:#620

  • [sql] calling .in_() (i.e. with no arguments) will return “CASE WHEN ( IS NULL) THEN NULL ELSE 0 END = 1)”, so that NULL or False is returned in all cases, rather than throwing an error

    参考文献:#545

  • [sql] fixed “where”/”from” criterion of select() to accept a unicode string in addition to regular string - both convert to text()

  • [sql] added standalone distinct() function in addition to column.distinct()

    参考文献:#558

  • [sql] result.last_inserted_ids() should return a list that is identically sized to the primary key constraint of the table. 被动地创建并且不能通过cursor.lastrowid得到的值将是None。

  • [sql] 长标识符检测固定使用>而不是> =用于最大标识长度

    参考文献:#589

  • [sql] fixed bug where selectable.corresponding_column(selectable.c.col) would not return selectable.c.col, if the selectable is a join of a table and another join involving the same table. 搞砸了ORM决策

    参考文献:#593

  • [sql] 将Interval类型添加到types.py

    参考文献:#595

MySQL的¶ T0>

  • [mysql] fixed catching of some errors that imply a dropped connection

    参考文献:#625

  • [mysql] 固定模运算符的转义

    参考文献:#624

  • [mysql] 将'fields'添加到保留字

    参考文献:#590

  • [mysql] 各种反射增强/修复

源码¶ T0>

  • [sqlite] 重新安排了方言初始化,所以有时间警告pysqlite1太老了。

  • [sqlite] sqlite better handles datetime/date/time objects mixed and matched with various Date/Time/DateTime columns

  • [sqlite] 字符串PK列插入不会被OID 覆盖

    参考文献:#603

MSSQL ¶ T0>

  • [mssql] fix port option handling for pyodbc

    参考文献:#634

  • [mssql] now able to reflect start and increment values for identity columns

  • [mssql] preliminary support for using scope_identity() with pyodbc

预言¶ T0>

  • [oracle] datetime fixes: got subsecond TIMESTAMP to work, added OracleDate which supports types.Date with only year/month/day

    参考文献:#604

  • [oracle] 添加方言标志“auto_convert_lobs”,默认为True;将导致在结果集中检测到的任何LOB对象被强制进入OracleBinary,这样,如果没有类型映射(即,如果发出文本execute()),则自动读取LOB(t2)。

  • [oracle] mod运算符'%'产生MOD

    参考文献:#624

  • [oracle] converts cx_oracle datetime objects to Python datetime.datetime when Python 2.3 used

    参考文献:#542

  • [oracle] 在Oracle TEXT类型中固定unicode转换¶

杂项¶ T0>

  • [ext] iteration over dict association proxies is now dict-like, not InstrumentedList-like (e.g. over keys instead of values)

  • [ext] association proxies no longer bind tightly to source collections, and are constructed with a thunk instead

    参考文献:#597

  • [ext] 将selectone_by()添加到assignmapper

  • [postgres] 固定模运算符的转义

    参考文献:#624

  • [postgres] 添加了对域的反射的支持

    参考文献:#570

  • [postgres] 类型解析为Null类型而不是引发错误

  • [postgres] 上面的“schema”中的修复修复了从alt-schema表到外部公共模式表的外键反映

0.3.8 ¶ T0>

发布日期:2007年6月2日

ORM ¶ T0>

  • [orm] added reset_joinpoint() method to Query, moves the “join point” back to the starting mapper. 0.4会改变join()的行为来重置所有情况下的“连接点”,所以这是一个临时的方法。为了向前兼容,确保使用单个join(),即join(['a','b','c'])来指定跨多个关系的连接。

  • [orm] fixed bug in query.instances() that wouldn’t handle more than on additional mapper or one additional column.

  • [orm] “delete-orphan”不再意味着“删除”。ongoing effort to separate the behavior of these two operations.

  • [orm] many-to-many relationships properly set the type of bind params for delete operations on the association table

  • [orm] many-to-many relationships check that the number of rows deleted from the association table by a delete operation matches the expected results

  • [orm] session.get() and session.load() propagate **kwargs through to query

  • [orm] 修复了多态查询,它允许将原始的polymorphic_union嵌入到相关的子查询中

    参考文献:#577

  • [orm] fix to select_by(=) -style joins in conjunction with many-to-many relationships, bug introduced in r2556

  • [orm] the “primary_key” argument to mapper() is propagated to the “polymorphic” mapper. 这个列表中的主键列被标准化为映射器本地表的主键列。

  • [orm] 在sa.orm.strategies记录器中恢复了“lazy loading clause”的记录,在0.3.7中被删除

  • [orm] improved support for eagerloading of properties off of mappers that are mapped to select() statements; i.e. eagerloader is better at locating the correct selectable with which to attach its LEFT OUTER JOIN.

  • SQL ¶ T0>

    • [sql] _Label class overrides compare_self to return its ultimate object. 意思是,如果你说someexpr.label('foo')== 5,它会产生正确的“someexpr == 5”。

    • [sql] _Label propagates “_hide_froms()” so that scalar selects behave more properly with regards to FROM clause #574

    • [sql] 通过(在映射程序查询中大量使用oid)将oid_column作为一个顺序来修复长名称生成

    • [sql] significant speed improvement to ResultProxy, pre-caches TypeEngine dialect implementations and saves on function calls per column

    • [sql] parenthesis are applied to clauses via a new _Grouping construct. 使用运算符优先级来更智能地将括号应用到子句中,提供更清晰的子句嵌套(不会改变放置在其他子句中的子句,即不包括'parens'标志)

    • [sql] 添加了“修饰符”关键字,其功能类似于func。除了不添加括号外。 T2>例如选择([modifier.DISTINCT(...)])等。

    • [sql] 移除了“在UNION”限制的选择中没有分组by“

      参考文献:#578

    MySQL的¶ T0>

    • [mysql] 现在几乎所有的MySQL列类型都支持声明和反射。添加了NCHAR,NVARCHAR,VARBINARY,TINYBLOB,LONGBLOB,YEAR

    • [mysql] sqltypes.Binary passthrough现在总是建立一个BLOB,避免了很老的数据库版本的问题

    • [mysql] 支持列级别CHARACTER SET和COLLATE声明,以及ASCII,UNICODE,NATIONAL和BINARY简写。

    火鸟¶ T0>

    • [firebird] 将最大标识符长度设置为31

    • [firebird] supports_sane_rowcount() set to False due to ticket #370. versioned_id_col feature wont work in FB.

    • [firebird] 一些执行修复

    • [firebird] 新的关联代理实现,实现完整的代理列表,字典和基于集合的关系集合

    • [firebird] 添加了orderslist,一个自定义列表类,用于将对象属性与列表中的对象位置同步

    • [firebird] 在select()中不会绕过SelectResultsExt。

    • [firebird] 添加了filter(),filter_by()to assignmapper

    杂项¶ T0>

    • [engines] 将detach()添加到Connection,允许将底层DBAPI连接从其池中分离,关闭dereference / close()而不是被池重用。 t2 >

    • [engines] 在Connection中添加了invalidate(),立即使Connection和它的底层DBAPI连接无效

    0.3.7 ¶ T0>

    发布于:2007年4月29日

    ORM ¶ T0>

    • [orm] fixed critical issue when, after options(eagerload()) is used, the mapper would then always apply query “wrapping” behavior for all subsequent LIMIT/OFFSET/DISTINCT queries, even if no eager loading was applied on those subsequent queries.

    • [orm] 添加了query.with_parent(someinstance)方法。使用父实例的延迟加入标准搜索目标实例。采取可选的字符串“属性”来隔离所需的关系。还增加了静态的Query.query_from_parent(instance,property)版本。

      参考文献:#541

    • [orm] improved query.XXX_by(someprop=someinstance) querying to use similar methodology to with_parent, i.e. using the “lazy” clause which prevents adding the remote instance’s table to the SQL, thereby making more complex conditions possible

      参考文献:#554

    • [orm] added generative versions of aggregates, i.e. sum(), avg(), etc. 进行查询。通过query.apply_max(),apply_sum()等使用#552 ¶ T0>

    • [orm] fix to using distinct() or distinct=True in combination with join() and similar

    • [orm] corresponding to label/bindparam name generation, eager loaders generate deterministic names for the aliases they create using md5 hashes.

    • [orm] improved/fixed custom collection classes when giving it “set”/ “sets.Set” classes or subclasses (was still looking for append() methods on them during lazy loads)

    • [orm] restored old “column_property()” ORM function (used to be called “column()”) to force any column expression to be added as a property on a mapper, particularly those that aren’t present in the mapped selectable. 这允许将任何类型的“标量表达式”作为关系来添加(尽管它们具有急切的加载问题)。

    • [orm] 修复了针对多态映射器的多对多关系

      参考文献:#533

    • [orm] making progress with session.merge() as well as combining its usage with entity_name

      参考文献:#543

    • [orm] the usual adjustments to relationships between inheriting mappers, in this case establishing relation()s to subclass mappers where the join conditions come from the superclass’ table

    SQL ¶ T0>

    • [sql] keys() of result set columns are not lowercased, come back exactly as they’re expressed in cursor.description. 注意这会导致colnames在oracle中全是大写。

    • [sql] preliminary support for unicode table names, column names and SQL statements added, for databases which can support them. 与sqlite和postgres到目前为止。Mysql 主要是,除了has_table()函数不起作用。反射也可以。

    • [sql] the Unicode type is now a direct subclass of String, which now contains all the “convert_unicode” logic. 这有助于更好地处理db中发生的各种unicode情况,如MS-SQL,并允许Unicode数据类型的子类化。

      参考文献:#522

    • [sql] ClauseElements can be used in in_() clauses now, such as bind parameters, etc. #476 ¶ T0>

    • [sql] reverse operators implemented for CompareMixin elements, allows expressions like “5 + somecolumn” etc. #474 ¶ T0>

    • [sql] the “where” criterion of an update() and delete() now correlates embedded select() statements against the table being updated or deleted. 这与嵌套select()语句的相关性相同,可以通过嵌入的select()中的correlate = False标志禁用。

    • [sql] column labels are now generated in the compilation phase, which means their lengths are dialect-dependent. 所以在oracle上,被截断为30个字符的标签将在postgres上出现63个字符。此外,真正的标签名总是作为访问者附加在父对象上,因此不需要知道“截断”标签名。

      参考文献:#512

    • [sql] column label and bind param “truncation” also generate deterministic names now, based on their ordering within the full statement being compiled. 这意味着相同的语句将在应用程序重新启动时产生相同的字符串,并允许DB查询计划缓存更好地工作。

    • [sql] the “mini” column labels generated when using subqueries, which are to work around glitchy SQLite behavior that doesn’t understand “foo.id” as equivalent to “id”, are now only generated in the case that those named columns are selected from (part of)

      参考文献:#513

    • [sql] the label() method on ColumnElement will properly propagate the TypeEngine of the base element out to the label, including a label() created from a scalar=True select() statement.

    • [sql] MS-SQL better detects when a query is a subquery and knows not to generate ORDER BY phrases for those

      参考文献:#513

    • [sql] fix for fetchmany() “size” argument being positional in most dbapis

      参考文献:#505

    • [sql] 将None作为参数发送到func。将产生一个NULL的参数

    • [sql] query strings in unicode URLs get keys encoded to ascii for **kwargs compat

    • [sql] slight tweak to raw execute() change to also support tuples for positional parameters, not just lists

      参考文献:#523

    • [sql] fix to case() construct to propagate the type of the first WHEN condition as the return type of the case statement

    MySQL的¶ T0>

    • [mysql] support for SSL arguments given as inline within URL query string, prefixed with “ssl_”, courtesy terjeros@gmail.com.

    • [mysql] [<schemaname>] mysql uses “DESCRIBE.”, catching exceptions if table doesn’t exist, in order to determine if a table exists. 这支持unicode表名称以及模式名称。使用MySQL5进行测试,但也应该使用4.1系列。(#557)¶ T0>

    源码¶ T0>

    • [sqlite] removed silly behavior where sqlite would reflect UNIQUE indexes as part of the primary key (?!)

    MSSQL ¶ T0>

    • [mssql] pyodbc is now the preferred DB-API for MSSQL, and if no module is specifically requested, will be loaded first on a module probe.

    • [mssql] 现在使用@@ SCOPE_IDENTITY代替@@ IDENTITY。这个行为可能被engine_connect“use_scope_identity”关键字参数覆盖,这个参数也可以在dburi中指定。

    预言¶ T0>

    • [oracle] 小修复程序允许连续编译具有LIMIT / OFFSET功能的相同SELECT对象。oracle方言需要修改对象的ROW_NUMBER OVER,并且不会执行连续编译的全部步骤。

    杂项¶ T0>

    • [engines] 警告模块用于发出警告(而不是记录)

    • [engines] cleanup of DBAPI import strategies across all engines

      参考文献:#480

    • [engines] refactoring of engine internals which reduces complexity, number of codepaths; places more state inside of ExecutionContext to allow more dialect control of cursor handling, result sets. ResultProxy完全重构,还有两个用于不同目的的“缓冲”结果集版本。

    • [engines] 在postgres中,服务器端的游标支持功能全面。

      参考文献:#514

    • [engines] improved framework for auto-invalidation of connections that have lost their underlying database, via dialect-specific detection of exceptions corresponding to that database’s disconnect related error messages. 此外,当检测到“连接不再打开”状态时,整个连接池将被丢弃,并替换为新的实例。#516 ¶ T0>

    • [engines] the dialects within sqlalchemy.databases become a setuptools entry points. 加载内置的数据库方言的工作方式与往常一样,但是如果没有发现将回退到尝试pkg_resources来加载外部模块

      参考文献:#521

    • [engines] Engine contains a “url” attribute referencing the url.URL object used by create_engine().

    • [informix] informix支持加入!James Zhang,他付出了很多努力。

    • [extensions] 对AssociationProxy的一个很大的修复,这样多个AssociationProxy对象可以和一个关联集合相关联

    • [extensions] assign_mapper names methods according to their keys (i.e. __name__) #551

    0.3.6 ¶ T0>

    发布:2007年3月23日星期五

    ORM ¶ T0>

    • [orm] the full featureset of the SelectResults extension has been merged into a new set of methods available off of Query. 这些方法都提供了“生成”的行为,查询被复制,并添加了新的标准。新方法包括:

      • filter() - 将选择条件应用于查询
      • filter_by() - 将“by”样式标准应用于查询
      • avg() - 返回给定列上的avg()函数
      • join() - 连接到一个属性(或跨属性列表)
      • outerjoin() - 像join(),但使用LEFT OUTER JOIN
      • limit()/ offset() - 应用LIMIT / OFFSET基于范围的访问,应用limit / offset:session.query(Foo)[3:5]
      • distinct() - 应用DISTINCT
      • list() - 评估标准并返回结果

      Query的API没有不兼容的变化,没有方法被弃用。像select(),select_by(),get(),get_by()这样的现有方法都会立即执行查询,并像往常一样返回结果。join_to()/ join_via()仍然存在,尽管生成的join()/ outerjoin()方法更容易使用。

    • [orm] the return value for multiple mappers used with instances() now returns a cartesian product of the requested list of mappers, represented as a list of tuples. 这对应于记录的行为。因此,实例匹配正确,使用此功能时禁用“uniquing”。

    • [orm] Query has add_entity() and add_column() generative methods. 这些将在编译时将给定的mapper / class或ColumnElement添加到查询中,并将它们应用于instances()方法。用户负责构建合理的连接条件(否则你可以得到完整的笛卡尔产品)。结果集是元组的列表,不是唯一的。

    • [orm] strings and columns can also be sent to the *args of instances() where those exact result columns will be part of the result tuples.

    • [orm] a full select() construct can be passed to query.select() (which worked anyway), but also query.selectfirst(), query.selectone() which will be used as is (i.e. no query is compiled). 与将结果发送到instances()类似。

    • [orm] eager loading will not “aliasize” “order by” clauses that were placed in the select statement by something other than the eager loader itself, to fix possibility of dupe columns as illustrated in. 然而,这意味着你必须更加小心Query.select()的“order by”中的列,你已经明确地将它们命名为你的标准(即你不能依靠渴望的加载器为你添加它们)¶ T0>

      参考文献:#495

    • [orm] added a handy multi-use “identity_key()” method to Session, allowing the generation of identity keys for primary key values, instances, and rows, courtesy Daniel Miller

    • [orm] many-to-many table will be properly handled even for operations that occur on the “backref” side of the operation

      参考文献:#249

    • [orm] added “refresh-expire” cascade. 允许refresh()和expire()调用沿关系传播。

      参考文献:#492

    • [orm] more fixes to polymorphic relations, involving proper lazy-clause generation on many-to-one relationships to polymorphic mappers. 还修复了检测“方向”的问题,对属于多态联合的列进行了更具体的定位,而不是那些没有定位的列。

      参考文献:#493

    • [orm] some fixes to relationship calcs when using “viewonly=True” to pull in other tables into the join condition which arent parent of the relationship’s parent/child mappings

    • [orm] flush fixes on cyclical-referential relationships that contain references to other instances outside of the cyclical chain, when some of the objects in the cycle are not actually part of the flush

    • [orm] put an aggressive check for “flushing object A with a collection of B’s, but you put a C in the collection” error condition - even if C is a subclass of B, unless B’s mapper loads polymorphically. 否则,集合稍后会加载一个“B”,该“B”应该是一个“C”(因为它不是多态的),它在双向关系中断开(即C有它的A,但是A的backref会把它作为一个不同类型的实例“B”)这个检查会咬一些没有问题的人,所以错误信息也会记录一个标志“enable_typechecks = False”来禁止这个检查。但要注意,没有这种检查,双向关系尤其会变得脆弱。

      参考文献:#500

    SQL ¶ T0>

    • [sql] bindparam()名称现在是可重复的!在一个语句中指定两个具有相同名称的不同的bindparam(),并且该键将被共享。正确的位置/命名参数在编译时翻译。对于具有冲突名称的“别名”绑定参数的旧行为,指定“unique = True” - 对于所有自动生成的(基于值的)绑定参数,此选项仍在内部使用。

    • [sql] slightly better support for bind params as column clauses, either via bindparam() or via literal(), i.e. select([literal(‘foo’)])

    • [sql] MetaData can bind to an engine either via “url” or “engine” kwargs to constructor, or by using connect() method. BoundMetaData与元数据是相同的,除了engine_or_url参数是必需的。DynamicMetaData是相同的,并提供线程本地连接是默认的。

    • [sql] exists() becomes useable as a standalone selectable, not just in a WHERE clause, i.e. exists([columns], criterion).select()

    • [sql] correlated subqueries work inside of ORDER BY, GROUP BY

    • [sql] 显式连接的固定函数执行,即conn.execute(func.dosomething())

    • [sql] use_labels flag on select() wont auto-create labels for literal text column elements, since we can make no assumptions about the text. 要为文字列创建标签,可以说“somecol AS somelabel”,或者使用literal_column(“somecol”)。label(“somelabel”)

    • [sql] quoting wont occur for literal columns when they are “proxied” into the column collection for their selectable (is_literal flag is propagated). 文字列通过literal_column(“somestring”)指定。

    • [sql] added “fold_equivalents” boolean argument to Join.select(), which removes ‘duplicate’ columns from the resulting column clause that are known to be equivalent based on the join condition. 当构建Postgres抱怨如果存在重复列名的连接子查询时,这是非常有用的。

    • [sql] 在ForeignKeyConstraint 上固定use_alter标志

      参考文献:#503

    • [sql] 在topological.py

      参考文献:#506

    • [sql] for hackers, refactored the “visitor” system of ClauseElement and SchemaItem so that the traversal of items is controlled by the ClauseVisitor itself, using the method visitor.traverse(item). accept_visitor()方法仍然可以直接调用,但不会做任何遍历的子项目。ClauseElement / SchemaItem现在有一个可配置的get_children()方法来返回每个父对象的子元素的集合。这使得遍历整个项目是清晰明确的(也是可记录的),并且有一个简单的限制遍历的方法(只要传递适当的get_children()方法传递的标志)。¶ t0 >

      参考文献:#501

    • [sql] the “else_” parameter to the case statement now properly works when set to zero.

    MySQL的¶ T0>

    • [mysql] 在MSString中添加了一个catchall ** kwargs,以帮助反映不明显的类型(如MS 4.0中的“varchar()binary”)

    • [mysql] 添加了显式的MSTimeStamp类型,在使用types.TIMESTAMP时生效。

    预言¶ T0>

    • [oracle] 得到任何大小输入的二进制工作!cx_oracle工作正常,这是我的错误,因为二进制被传递,而不是BLOB的setinputsizes(也单元测试甚至没有设置输入大小)

    • [oracle] 也修正了CLOB读/写在一个单独的变更集上。

    • [oracle] auto_setinputsizes defaults to True for Oracle, fixed cases where it improperly propagated bad types.

    杂项¶ T0>

    • [extensions] options() method on SelectResults now implemented “generatively” like the rest of the SelectResults methods. 但是你现在只需要使用Query。

      参考文献:#472

    • [extensions] query() method is added by assignmapper. 这有助于导航到Query上的所有新生成方法。

    • [ms-sql]

      在DATE列类型中移除了秒输入(可能是
      应该删除时间)

    • [ms-sql] 浮点字段中的空值不再引发错误

    • [ms-sql] LIMIT with OFFSET now raises an error (MS-SQL has no OFFSET support)

    • [ms-sql] added an facility to use the MSSQL type VARCHAR(max) instead of TEXT for large unsized string fields. 使用新的“text_as_varchar”将其打开。

      参考文献:#509

    • [ms-sql] ORDER BY clauses without a LIMIT are now stripped in subqueries, as MS-SQL forbids this usage

    • [ms-sql] cleanup of module importing code; specifiable DB-API module; more explicit ordering of module preferences.

      参考文献:#480

    0.3.5 ¶ T0>

    发布日期:2007年2月22日

    ORM ¶ T0>

    • [orm] [bugs] another refactoring to relationship calculation. 允许更准确的ORM行为与映射器之间的/到/之间的关系,特别是多态映射器,以及Query,SelectResults的使用。门票包括,null,null,

      References: #441, #448, #439

    • [orm] [bugs] 删除了在类上指定自定义集合的不赞成使用的方法;你现在必须使用“collection_class”选项。当人们使用assign_mapper()时,旧的方式开始产生冲突,这个方法现在修补了一个“选项”方法,与一个名为“options”的关系结合在一起。(关系优先于monkeypatched assign_mapper方法)。

    • [orm] [bugs] extension() query option propagates to Mapper._instance() method so that all loading-related methods get called

      参考文献:#454

    • [orm] [bugs] 如果关系没有返回行,那么与继承映射器的紧密关系不会失败。

    • [orm] [bugs] 渴望的关系加载错误修复了多个后代类的渴望关系

      参考文献:#486

    • [orm] [bugs] 修复非常大的拓扑排序,在gmail 处提供ants.aasma

      参考文献:#423

    • [orm] [bugs] eager loading is slightly more strict about detecting “self-referential” relationships, specifically between polymorphic mappers. 这会导致“急切降级”到延迟加载。

    • [orm] [bugs] 改进了对嵌入“where”条件中的复杂查询的支持query.select()

      参考文献:#449

    • [orm] [bugs] 映​​射器选项(如eagerload(),lazyload(),deferred())将用于“synonym()”关系

      参考文献:#485

    • [orm] [bugs] fixed bug where cascade operations incorrectly included deleted collection items in the cascade

      参考文献:#445

    • [orm] [bugs] 当一对多子项移动到一个工作单元中的新父项时,固定关系删除错误

      参考文献:#478

    • [orm] [bugs] fixed relationship deletion error where parent/child with a single column as PK/FK on the child would raise a “blank out the primary key” error, if manually deleted or “delete” cascade without “delete-orphan” was used

    • [orm] [bugs] 固定为延迟,这样当只设置了PK col属性时,加载操作不会错误发生

    • [orm] [enhancements] 实现了映射器的foreign_keys参数。与primaryjoin / secondaryjoin参数结合使用来指定/覆盖在Table实例上定义的外键。

      参考文献:#385

    • [orm] [enhancements] contains_eager(‘foo’) automatically implies eagerload(‘foo’)

    • [orm] [enhancements] 向contains_eager()添加了“别名”参数。用它来指定查询中用于急切加载的子项的别名的字符串名称或别名实例。比“装饰者”更容易使用

    • 结果集映射到映射表的别名[orm] [enhancements] 添加了“contains_alias()”选项

    • [orm] [enhancements] 增加了对“py2.5”的支持,“with SessionTransaction

      参考文献:#468

    SQL ¶ T0>

    • [sql] “case_sensitive”的值现在默认为True,而不管标识符的大小写,除非专门设置为False。这是因为这个对象可能被标记为包含混合大小写的其他东西,并且通过“case_sensitive = False”来破坏它。在使用标签和“假”列对象时引用的其他修正

    • [sql] added a “supports_execution()” method to ClauseElement, so that individual kinds of clauses can express if they are appropriate for executing...such as, you can execute a “select”, but not a “Table” or a “Join”.

    • [sql] fixed argument passing to straight textual execute() on engine, connection. 可以处理* args或者位置列表实例,** kwargs或者一个dict实例,或者一个列表或者一个列表或者一个列表或者一个列表来调用executemany()

    • [sql] 小修复BoundMetaData接受unicode或字符串的URL

    • [sql] 在gmail 处固定名为PrimaryKeyConstraint的代理礼让andrija

      参考文献:#466

    • [sql] 在列上固定生成CHECK约束

      参考文献:#464

    • [sql] fixes to tometadata() operation to propagate Constraints at column and table level

    MySQL的¶ T0>

    • [mysql] 修复可能返回array()类型为“show variables like”语句的旧数据库的反射

    MSSQL ¶ T0>

    • [mssql] preliminary support for pyodbc (Yay!)

      参考文献:#419

    • [mssql] 更好地支持添加的NVARCHAR类型

      参考文献:#298

    • [mssql] 修复pymssql的提交逻辑

    • [mssql] 用模式修复query.get()¶

      参考文献:#456

    • [mssql] 修复非整数关系

      参考文献:#473

    • [mssql] 运行时现在可以选择DB-API模块

      参考文献:#419

    • [mssql] [415] [tickets:422] [481] 现在通过了更多的单元测试

    • [mssql] 更好的单元测试与ANSI函数的兼容性

      参考文献:#479

    • [mssql] 改进了对带有自动插入的隐式序列PK列的支持

      参考文献:#415

    • [mssql] 在adodbapi 中修正空白密码¶

      参考文献:#371

    • [mssql] 修复了使用pyodbc 的单元测试

      参考文献:#481

    • [mssql] 修复db-url查询中的auto_identity_insert

    • [mssql] 将query_timeout添加到db-url查询参数中。目前仅适用于pymssql

    • 用pymssql 0.8.0(现在是LGPL)测试[mssql]

    预言¶ T0>

    • [oracle] when returning “rowid” as the ORDER BY column or in use with ROW_NUMBER OVER, oracle dialect checks the selectable its being applied to and will switch to table PK if not applicable, i.e. for a UNION. 检查DISTINCT,GROUP BY(其他地方那个rowid是无效的)仍然是一个TODO。允许多态映射运行。

      参考文献:#436

    • [oracle] sequences on a non-pk column will properly fire off on INSERT

    • [oracle] 增加了PrefetchingResultProxy支持,当它们被认为存在时预取LOB列,修复

      参考文献:#435

    • [oracle] 实现了基于同义词的表反射,包括跨越dblinks

      参考文献:#379

    • [oracle] 由于某些权限错误而无法反映相关表时,会发出日志警告

      参考文献:#363

    杂项¶ T0>

    • [postgres] 更好地反映交替模式表的序列

      参考文献:#442

    • [postgres] sequences on a non-pk column will properly fire off on INSERT

    • [postgres] 添加了PGInterval类型,PGInet类型

      参考文献:#460#444

    • [extensions] 在SelectResults中添加了distinct()方法。一般只应该在使用count()时有所作为。

    • [extensions] 在SelectResults中添加了options()方法,相当于query.options()

      参考文献:#472

    • [extensions] 将可选的__table_opts__字典添加到ActiveMapper中,将kw选项发送给Table对象

      参考文献:#462

    • [extensions] 将selectfirst(),selectfirst_by()添加到assign_mapper

      参考文献:#467

    0.3.4 ¶ T0>

    发布日期:2007年1月23日

    一般¶ T0>

    • [general] global “insure”->”ensure” change. in US english “insure” is actually largely interchangeable with “ensure” (so says the dictionary), so I’m not completely illiterate, but its definitely sub-optimal to “ensure” which is non-ambiguous.

    ORM ¶ T0>

    • [orm] poked the first hole in the can of worms: saying query.select_by(somerelationname=someinstance) will create the join of the primary key columns represented by “somerelationname“‘s mapper to the actual primary key in “someinstance”.

    • [orm] reworked how relations interact with “polymorphic” mappers, i.e. mappers that have a select_table as well as polymorphic flags. 更好地确定正确的连接条件,与用户定义的连接条件进行交互以及支持自引用多态映射器。

    • [orm] related to polymorphic mapping relations, some deeper error checking when compiling relations, to detect an ambiguous “primaryjoin” in the case that both sides of the relationship have foreign key references in the primary join condition. 还收紧了用于定位“关系方向”的条件,将关系的“外键”与“主连接”相关联

    • [orm] a little bit of improvement to the concept of a “concrete” inheritance mapping, though that concept is not well fleshed out yet (added test case to support concrete mappers on top of a polymorphic base).

    • [orm] 固定在synonym()上的“proxy = True”行为

    • [orm] fixed bug where delete-orphan basically didn’t work with many-to-many relationships, backref presence generally hid the symptom

      参考文献:#427

    • [orm] 在映射器编译步骤中添加了一个互斥体。我不愿意为SA添加任何类型的线程,但是这是一个真正需要的地方,因为mapper通常是“全局的”,而在正常运行期间它们的状态不会改变,所以初始编译步骤会显着地修改内部状态,这一步通常不是在模块级的初始化时间(除非你调用了compile()),而是在第一次请求的时候

    • [orm] basic idea of “session.merge()” actually implemented. 需要更多的测试。

    • [orm] 添加了“compile_mappers()”函数作为编译所有映射器的快捷方式

    • [orm] 修复MapperExtension create_instance,使entity_name与新实例正确关联

    • [orm] speed enhancements to ORM object instantiation, eager loading of rows

    • [orm] invalid options sent to ‘cascade’ string will raise an exception

      参考文献:#406

    • [orm] fixed bug in mapper refresh/expire whereby eager loaders didn’t properly re-populate item lists

      参考文献:#407

    • [orm] 修复post_update,以确保行更新,即使是非插入/删除方案

      参考文献:#413

    • [orm] added an error message if you actually try to modify primary key values on an entity and then flush it

      参考文献:#412

    SQL ¶ T0>

    • [sql] 在ResultProxy中添加了“fetchmany()”支持

    • [sql] 增加了对列“key”属性的支持,以便在行[] / row中使用

    • [sql] 将“BooleanExpression”从“BinaryExpression”改为子类,以便布尔表达式也可以遵循列子句行为(即label()等)。

    • [sql] trailing underscores are trimmed from func. calls, such as func.if_()

    • [sql] fix to correlation of subqueries when the column list of the select statement is constructed with individual calls to append_column(); this fixes an ORM bug whereby nested select statements were not getting correlated with the main select generated by the Query object.

    • [sql] another fix to subquery correlation so that a subquery which has only one FROM element will not correlate that single element, since at least one FROM element is required in a query.

    • [sql] 默认的“时区”设置现在是False。这对应于Python的日期时间行为以及Postgres的时间戳/时间类型(这是目前唯一的时区敏感的方言)

      参考文献:#414

    • [sql] the “op()” function is now treated as an “operation”, rather than a “comparison”. 不同之处在于,一个操作产生一个BinaryExpression,从中可以进行进一步的操作,而比较产生的限制性更强的BooleanExpression

    • [sql] trying to redefine a reflected primary key column as non-primary key raises an error

    • [sql] 类型的系统稍作修改,以支持TypeDecorators,可以被方言覆盖(好的,这不是很清楚,它允许下面的mssql调整)

    MySQL的¶ T0>

    • [mysql] mysql is inconsistent with what kinds of quotes it uses in foreign keys during a SHOW CREATE TABLE, reflection updated to accommodate for all three styles

      参考文献:#420

    • [mysql] mysql table create options work on a generic passthru now, i.e. Table(..., mysql_engine=’InnoDB’, mysql_collate=”latin1_german2_ci”, mysql_auto_increment=”5”, mysql_...), helps

      参考文献:#418

    MSSQL ¶ T0>

    • [mssql] 添加了NVarchar类型(生成NVARCHAR),也提供了MSUnicode,它为NVarchar提供了Unicode转换,而不管方言convert_unicode设置如何。

    预言¶ T0>

    • [oracle] slight support for binary, but still need to figure out how to insert reasonably large values (over 4K). 要求auto_setinputsizes = True发送到create_engine(),行必须单独完全提取等。

    火鸟¶ T0>

    • [firebird] order of constraint creation puts primary key first before all other constraints; required for firebird, not a bad idea for others

      参考文献:#408

    • [firebird] Firebird fix to autoload multifield foreign keys

      参考文献:#409

    • [firebird] Firebird NUMERIC类型正确处理一个没有精度的类型

      参考文献:#409

    杂项¶ T0>

    • [postgres] 修复表格的初始checkfirst以将当前模式考虑进去

      参考文献:#424

    • [postgres] postgres has an optional “server_side_cursors=True” flag which will utilize server side cursors. 这些仅适用于获取部分结果,对于处理非常大的无限结果集是非常必要的。虽然我们希望这是默认行为,但是不同的环境似乎有不同的结果,原因并没有被隔离,所以我们现在默认关闭此功能。最近在psycopg邮件列表中发现了一个显然没有记录的psycopg2行为。

    • [postgres] 使用PGBigInteger / autoincrement添加了“BIGSERIAL”对postgres表的支持

    • [postgres] 修复了postgres反射,以便在模式名称存在时更好地处理;感谢jason(at)ncsmags.com

      参考文献:#402

    • [extensions] added “validate=False” argument to assign_mapper, if True will ensure that only mapped attributes are named

      参考文献:#426

    • [extensions] assign_mapper gets “options”, “instances” functions added (i.e. MyClass.instances())

    0.3.3 ¶ T0>

    发布:2006年12月15日星期五
    • 基于字符串的FROM子句是固定的,即select(...,from_obj = [“sometext”])

    • 修复了passive_deletes标志,lazy = None(noload)flag

    • 添加了用于处理大集合的示例/ docs

    • added object_session() method to sqlalchemy namespace

    • fixed QueuePool bug whereby its better able to reconnect to a database that was not reachable (thanks to Sébastien Lelong), also fixed dispose() method

    • 使MySQL行计数正确工作的补丁

      参考文献:#396

    • 修复了2006/2014年错误的MySQL catch,以正确地重新引发OperationalError异常

    0.3.2 ¶ T0>

    发布日期:2006年12月10日
    • 修正了主要的连接池错误。修复了MySQL不同步错误,也将防止事务在所有数据库中意外回滚

      参考文献:#387

    • major speed enhancements vs. 0.3.1, to bring speed back to 0.2.8 levels

    • 有条件地执行几十个调试日志调用,而这些调用的生成日志消息的时间很多

    • fixed bug in cascade rules whereby the entire object graph could be unnecessarily cascaded on the save/update cascade

    • 属性模块中的各种加速

    • 会话中的身份映射默认为不再弱引用要使其引用较弱,请使用create_session(weak_identity_map = True)修复

      参考文献:#388

    • MySQL detects errors 2006 (server has gone away) and 2014 (commands out of sync) and invalidates the connection on which it occurred.

    • MySQL布尔类型修正:

      参考文献:#307

    • postgres反射修复:

      参考文献:#382#349

    • 为EXCEPT,INTERSECT,EXCEPT ALL,INTERSECT ALL添加了关键字

      参考文献:#247

    • assign_mapper in assignmapper extension returns the created mapper

      参考文献:#2110

    • added label() function to Select class, when scalar=True is used to create a scalar subquery i.e. “select x, y, (select max(foo) from table) AS foomax from table”

    • 将onUpdate和ondelete关键字参数添加到ForeignKey;如果存在,则传播到底层的ForeignKeyConstraint。(但不要向另一个方向传播)

    • fix to session.update() to preserve “dirty” status of incoming object

    • sending a selectable to an IN via the in_() function no longer creates a “union” out of multiple selects; only one selectable to a the in_() function is allowed now (make a union yourself if union is needed)

    • 改进了对通过cascade =“none”禁用save-update级联的支持。

    • added “remote_side” argument to relation(), used only with self-referential mappers to force the direction of the parent/child relationship. 替换“切换”方向的“外键”参数的用法。“foreignkey”参数在所有用途上都被弃用,并最终被在映射程序中专用于ForeignKey规范的参数取代。

    0.3.1 ¶ T0>

    发行时间:2006年11月13日

    ORM ¶ T0>

    • [orm] the “delete” cascade will load in all child objects, if they were not loaded already. 这可以通过在关系()上设置passive_deletes = True来关闭(即旧行为)。

    • [orm] 调整以重写预先生成的查询,不会在循环加载的关系(如后退)上失败

    • [orm] fixed bug where eagerload() (nor lazyload()) option didn’t properly instruct the Query whether or not to use “nesting” when producing a LIMIT query.

    • [orm] fixed bug in circular dependency sorting at flush time; if object A contained a cyclical many-to-one relationship to object B, and object B was just attached to object A, but object B itself wasn’t changed, the many-to-one synchronize of B’s primary key attribute to A’s foreign key attribute wouldn’t occur.

      参考文献:#360

    • [orm] implemented from_obj argument for query.count, improves count function on selectresults

      参考文献:#325

    • [orm] added an assertion within the “cascade” step of ORM relationships to check that the class of object attached to a parent object is appropriate (i.e. if A.items stores B objects, raise an error if a C is appended to A.items)

    • [orm] new extension sqlalchemy.ext.associationproxy, provides transparent “association object” mappings. 新的示例examples / association / proxied_association.py说明了

    • [orm] improvement to single table inheritance to load full hierarchies beneath the target class

    • [orm] 修复了拓扑排序中的细微情况,其中节点可能出现两次,

      参考文献:#362

    • [orm] 对拓扑排序,重构进行额外的返工,用于

      参考文献:#365

    • [orm] “delete-orphan” for a certain type can be set on more than one parent class; the instance is an “orphan” only if its not attached to any of those parents

    杂项¶ T0>

    • [engine/pool] 一些新的Pool实用程序类,更新的文档

    • [engine/pool] “use_threadlocal” on Pool defaults to False (same as create_engine)

    • [engine/pool] fixed direct execution of Compiled objects

    • [engine/pool] create_engine()返工对传入的** kwargs严格。所有的关键字参数必须被方言,连接池和引擎构造函数之一所使用,否则就会抛出一个TypeError,它描述了与选定的dialect / pool / engine配置有关的全套无效kwargs。 T0>

    • [databases/types] MySQL catches exception on “describe” and reports as NoSuchTableError

    • [databases/types] 进一步修复了sqlite的布尔值,没有作为默认工作

    • [databases/types] 使用模式修复postgres序列引用

    0.3.0 ¶ T0>

    发布日期:2006年10月22日

    一般¶ T0>

    • [general] logging is now implemented via standard python “logging” module. “回声”关键字参数仍然有效,但为其各自的类/实例设置/取消设置日志级别。所有日志记录都可以通过Python API直接控制,方法是在“sqlalchemy”命名空间中为记录器设置INFO和DEBUG级别。类级日志记录在“sqlalchemy。”下面,在“sqlalchemy。.0x”下面的实例级日志记录下。 T3> T2> T1> T0>测试套件包括独立于-verbose / -quiet工作的“-log-info”和“-log-debug”参数。将记录添加到orm以允许跟踪映射器配置,行迭代。

    • [general] the documentation-generation system has been overhauled to be much simpler in design and more integrated with Markdown

    ORM ¶ T0>

    • [orm] attribute tracking modified to be more intelligent about detecting changes, particularly with mutable types. 现在,TypeEngine对象在定义如何比较两个标量实例(包括添加由PickleType实现的MutableType混合)方面发挥了更大的作用。工作单元现在将“脏”列表作为属性管理器检测到变化的所有持久对象的表达式来追踪。固定的基本问题是检测PickleType对象上的变化,但也推广了类型处理和“修改”对象检查,使其更加完整和可扩展。

    • [orm] a wide refactoring to “attribute loader” and “options” architectures. ColumnProperty和PropertyLoader通过可切换的“策略”定义它们的加载行为,MapperOptions不再使用映射器/属性复制功能;它们在查询/实例时间通过QueryContext和SelectionContext对象传播。所有用于处理继承的映射器和属性以及options()的内部拷贝已被删除;映射器和属性的结构比以前简单得多,并且在新的“接口”模块中清楚地展现出来。

    • [orm] related to the mapper/property overhaul, internal refactoring to mapper instances() method to use a SelectionContext object to track state during the operation. SLIGHT API BREAKAGE: the append_result() and populate_instances() methods on MapperExtension have a slightly different method signature now as a result of the change; hoping that these methods are not in widespread use as of yet.

    • [orm] 实例()方法现在移动到Query,向后兼容的版本保留在映射器上

    • [orm] added contains_eager() MapperOption, used in conjunction with instances() to specify properties that should be eagerly loaded from the result set, using their plain column names by default, or translated given an custom row-translation function.

    • [orm] more rearrangements of unit-of-work commit scheme to better allow dependencies within circular flushes to work properly...updated task traversal/logging implementation

    • [orm] polymorphic mappers (i.e. using inheritance) now produces INSERT statements in order of tables across all inherited classes

      参考文献:#321

    • [orm] added an automatic “row switch” feature to mapping, which will detect a pending instance/deleted instance pair with the same identity key and convert the INSERT/DELETE to a single UPDATE

    • [orm] “关联”映射简化以利用自动“行开关”功能

    • [orm] “custom list classes” is now implemented via the “collection_class” keyword argument to relation(). 旧的方式仍然有效,但不推荐使用

      参考文献:#212

    • [orm] added “viewonly” flag to relation(), allows construction of relations that have no effect on the flush() process.

    • [orm] added “lockmode” argument to base Query select/get functions, including “with_lockmode” function to get a Query copy that has a default locking mode. 将“read”/“update”参数转换为选择端的for_update参数。

      参考文献:#292

    • [orm] implemented “version check” logic in Query/Mapper, used when version_id_col is in effect and query.with_lockmode() is used to get() an instance that’s already loaded

    • [orm] post_update行为得到改善;在不更新太多的行方面做得更好,只更新需要的列

      参考文献:#208

    • [orm] adjustments to eager loading so that its “eager chain” is kept separate from the normal mapper setup, thereby preventing conflicts with lazy loader operation, fixes

      参考文献:#308

    • [orm] 修复延迟群组加载

    • [orm] session.flush() wont close a connection it opened

      参考文献:#346

    • [orm] 向映射器添加了“batch = True”标志;如果为False,则save_obj将一次完全保存一个对象,包括调用before_XXXX和after_XXXX

    • [orm] 向mapper添加了“column_prefix = None”参数;将给定的字符串(通常为'_')预加到从映射程序Table自动设置的基于列的属性

    • [orm] specifying joins in the from_obj argument of query.select() will replace the main table of the query, if the table is somewhere within the given from_obj. 这使得可以在查询中生成自定义连接和外部连接,而无需增加两次主表。

      参考文献:#315

    • [orm] 调整eagerloading以更周到地将它的LEFT OUTER JOIN附加到给定的查询中,寻找可能已经设置好的自定义的“FROM”子句。

    • [orm] added join_to and outerjoin_to transformative methods to SelectResults, to build up join/outerjoin conditions based on property names. 还添加了select_from来显式设置from_obj参数。

    • [orm] 从映射器中移除了“is_primary”标志。

    SQL ¶ T0>

    • [sql] [construction] changed “for_update” parameter to accept False/True/”nowait” and “read”, the latter two of which are interpreted only by Oracle and Mysql

      参考文献:#292

    • [sql] [construction] added extract() function to sql dialect (SELECT extract(field FROM expr))

    • [sql] [construction] BooleanExpression includes new “negate” argument to specify the appropriate negation operator if one is available.

    • [sql] [construction] calling a negation on an “IN” or “IS” clause will result in “NOT IN”, “IS NOT” (as opposed to NOT (x IN y)).

    • [sql] [construction] 函数对象现在知道在FROM子句中要做什么。他们的行为应该是相同的,除了现在你也可以做像select(['*'],from_obj = [func.my_function()])从结果中获取多个列,甚至使用sql.column()构造命名返回列

      参考文献:#172

    架构¶ T0>

    • [schema] a fair amount of cleanup to the schema package, removal of ambiguous methods, methods that are no longer needed. 使用稍微受限制,更强调明确性

    • [schema] the “primary_key” attribute of Table and other selectables becomes a setlike ColumnCollection object; is ordered but not numerically indexed. 可以通过table1.primary_key == table2.primary_key 生成从相同基础表派生的两个pks之间的比较子句(即,例如两个Alias对象)

    • [schema] ForeignKey(Constraint) supports “use_alter=True”, to create/drop a foreign key via ALTER. 这允许建立循环外键关系。

    • [schema] append_item() methods removed from Table and Column; preferably construct Table/Column/related objects inline, but if needed use append_column(), append_foreign_key(), append_constraint(), etc.

    • [schema] table.create() no longer returns the Table object, instead has no return value. 通常的情况是表格是通过元数据创建的,这是可取的,因为它会处理表格依赖关系。

    • [schema] added UniqueConstraint (goes at Table level), CheckConstraint (goes at Table or Column level).

    • [schema] index=False/unique=True on Column now creates a UniqueConstraint, index=True/unique=False creates a plain Index, index=True/unique=True on Column creates a unique Index. 'index'和'unique'关键字参数列仅为布尔值;对于explcit名字和索引分组或者唯一约束,明确地使用UniqueConstraint / Index结构。

    • [schema] 在列中添加了autoincrement = True;将显式设置为False 将禁止为postgres / mysql / mssql生成SERIAL / AUTO_INCREMENT / identity seq的模式

    • [schema] TypeEngine objects now have methods to deal with copying and comparing values of their specific type. 目前由ORM使用,见下文。

    • [schema] 固定条件是在主键列爆炸性重写时发生的反射,其中PrimaryKeyConstraint会使反射列和编程列都加倍

    • [schema] the “foreign_key” attribute on Column and ColumnElement in general is deprecated, in favor of the “foreign_keys” list/set-based attribute, which takes into account multiple foreign keys on one column. “foreign_key”将返回“foreign_keys”列表中的第一个元素,如果列表为空,则返回None。

    源码¶ T0>

    • [sqlite] sqlite boolean datatype converts False/True to 0/1 by default

    • [sqlite] 修复日期/时间(SLDate / SLTime)类型;现在和postgres一样好

      参考文献:#335

    预言¶ T0>

    • [oracle] Oracle has experimental support for cx_Oracle.TIMESTAMP, which requires a setinputsizes() call on the cursor that is now enabled via the ‘auto_setinputsizes’ flag to the oracle dialect.

    火鸟¶ T0>

    • [firebird] 别名不使用“AS”

    • [firebird] 在反映不存在的表时正确地引发NoSuchTableError

    杂项¶ T0>

    • [ms-sql] fixes bug 261 (table reflection broken for MS-SQL case-sensitive databases)

    • [ms-sql] can now specify port for pymssql

    • [ms-sql] introduces new “auto_identity_insert” option for auto-switching between “SET IDENTITY_INSERT” mode when values specified for IDENTITY columns

    • [ms-sql] now supports multi-column foreign keys

    • [ms-sql] 固定为反映日期/日期时间列

    • [ms-sql] NCHAR and NVARCHAR type support added

    • [connections/pooling/execution] connection pool tracks open cursors and automatically closes them if connection is returned to pool with cursors still opened. 可能会受到导致它提出错误的选项的影响,或者什么也不做。修复了MySQL和其他问题的问题

    • [connections/pooling/execution] 固定的错误,其中连接将不会失去事后提交/回滚

    • [connections/pooling/execution] 将scalar()方法添加到ComposedSQLEngine,ResultProxy

    • [connections/pooling/execution] ResultProxy will close() the underlying cursor when the ResultProxy itself is closed. 这将自动关闭所有已取出行的ResultProxy对象的游标(或已调用scalar())。

    • [connections/pooling/execution] ResultProxy.fetchall() internally uses DBAPI fetchall() for better efficiency, added to mapper iteration as well (courtesy Michael Twomey)