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

SQLAlchemy 1.1文档

0.3更新日志

0.3.11 ¶ T0>

发布日期:2007年10月14日

ORM ¶ T0>

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

    参考文献:#687

  • [orm] 修正了Session.merge()中的一个小异常抛出错误(

  • [orm] 固定的错误,其中映射器,链接到一个表没有PK列的连接,不会检测到连接的表没有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] 调整像func.count(t.c.col.distinct())这样的子句的DISTINCT优先级

  • [sql] 修复了内部'$'字符的检测:bind $ params

    参考文献:#719

  • [sql] 不要假设连接条件只包含列对象

    参考文献:#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] 索引名现在在从反映表中删除时引用

    参考文献:#684

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

预言¶ T0>

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

    参考文献:#622#751

火鸟¶ T0>

  • 由于票#370(正确的方式)[firebird] supports_sane_rowcount()设置为False

  • [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 = 设置MetaData的“绑定”

ORM ¶ T0>

  • [orm] 向前兼容0.4:向Query添加one(),first()和all()。几乎所有来自0.4的Query功能都出现在0.3.9中,用于前向兼容目的。

  • [orm] reset_joinpoint()这次确实真的有效,诺言!可以让你重新加入根:query.join(['a','b'])。filter()。reset_joinpoint()。join(['a','c'])。filter )。all中的all()在所有join()调用中都从“root”开始

  • [orm] 向mapper()构造步骤添加了同步,以避免预先存在的映射器在另一个线程中编译时的线程冲突

    参考文献:#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 = False关系

  • [orm] 请记住关于polymorphic_union的所有内容吗?用于连接表继承?有趣的事情......你可以通过outerjoin()将所有的表串联在一起。但是,如果涉及具体表,UNION仍然适用(因为没有任何关联)。

  • [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,MetaData是直接替代。

  • [sql] DynamicMetaData已重命名为ThreadLocalMetaData。DynamicMetaData名称已被弃用,并且是ThreadLocalMetaData或常规元数据的别名,如果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

  • [sql] 固定“歧义列”结果检测,当dupe col名称存在于结果中时

    参考文献:#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] 在QueuePool的“溢出”计算中添加了一个互斥量,以防止可能绕过max_overflow的争用条件

  • [sql] 固定分组的复合选择给出正确的结果。会在某些情况下在sqlite中断开,但是这些情况无论如何都会产生不正确的结果,sqlite不支持分组复合选择

    参考文献:#623

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

    参考文献:#620

  • [sql] 调用.in_()(即没有参数)将返回“CASE WHEN(IS NULL)THEN NULL ELSE 0 END = 1)”,在任何情况下都会返回False,而不是抛出错误

    参考文献:#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] 固定捕获一些暗示连接断开的错误

    参考文献:#625

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

    参考文献:#624

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

    参考文献:#590

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

源码¶ T0>

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

  • [sqlite] sqlite更好地处理与各种日期/时间/日期时间列混合和匹配的日期/时间/时间对象

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

    参考文献:#603

MSSQL ¶ T0>

  • [mssql] 修复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修复:获得亚秒TIMESTAMP工作,添加了支持类型日期的OracleDate,只有年/月/日

    参考文献:#604

  • [oracle] 添加方言标志“auto_convert_lobs”,默认为True;将导致在结果集中检测到的任何LOB对象被强制进入OracleBinary,以便在没有类型映射的情况下自动读取LOB(即,如果发布了文本execute())。¶ 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] 关联代理不再紧密地绑定到源集合,而是用thunk构建而不是

    参考文献:#597

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

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

    参考文献:#624

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

    参考文献:#570

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

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

0.3.8 ¶ T0>

发布日期:2007年6月2日

ORM ¶ T0>

  • [orm] 在查询中添加了reset_joinpoint()方法,将“连接点”移回到起始映射器。0.4会改变join()的行为来重置所有情况下的“连接点”,所以这是一种临时方法。为了向前兼容,确保使用单个join(),即join(['a','b','c'])来指定跨多个关系的连接。

  • [orm] 修正了query.instances()中的错误,该错误不会处理超过附加映射器或一个附加列。

  • [orm] “delete-orphan”不再意味着“删除”。正在不断努力分离这两种操作的行为。

  • [orm] 多对多关系正确设置关联表上删除操作的绑定参数的类型

  • [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] 修复了select_by(= )风格的连接与多对多关系,r2556中引入的bug t3 > T2>

  • [orm] 映​​射器()的“primary_key”参数传播到“多态”映射器。这个列表中的主键列被标准化为映射器本地表格的主键列。

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

  • [orm] 改进了对映射到select()语句的映射器的属性的预先加载支持;即eagerloader可以更好地定位正确的可选属性,以便连接它的LEFT OUTER JOIN。

SQL ¶ T0>

  • [sql] _Label类重写compare_self以返回其最终对象。意思是,如果你说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] 添加了'modifier'关键字,其功能类似于func。除了不添加括号外。 T2>例如select([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()添加到了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(实例,属性)版本。

    参考文献:#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] 固定使用distinct()或distinct = True与join()以及类似的

  • [orm] 对应于label / bindparam名称的生成,eager loader为使用md5哈希创建的别名生成确定性名称。

  • [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] 在session.merge()方面取得进展,并将其用法与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. 注意这会导致colname在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] Unicode类型现在是String的直接子类,它现在包含所有“convert_unicode”逻辑。这有助于更好地处理db中发生的各种unicode情况,例如MS-SQL,并允许Unicode数据类型的子类化。

    参考文献:#522

  • [sql] 现在可以在in_()子句中使用ClauseElements,例如绑定参数等。#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个字符。另外,真正的标签名总是作为访问者附加在父节点Selectable上,因此不需要知道“截断”标签名称。

    参考文献:#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更好地检测到查询是子查询的时候,并且知道不会为那些生成ORDER BY短语

    参考文献:#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] 原始的execute()改变也稍微改变,以支持位置参数的元组,而不仅仅是列表

    参考文献:#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使用“DESCRIBE。”,在表不存在的情况下捕获异常,以确定表是否存在。[mysql] [<schemaname>] T2>这支持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] 跨所有引擎清理DBAPI导入策略

    参考文献:#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] 通过特定于方言的检测与数据库的断开连接相关的错误消息相对应的异常来自动失效已丢失其基础数据库的连接的改进框架。此外,当检测到“连接不再打开”条件时,整个连接池将被丢弃并替换为新实例。#516 ¶ T0>

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

    参考文献:#521

  • [engines] 引擎包含引用create_engine()所使用的url.URL对象的“url”属性。

  • [informix] 加入informix支持!礼貌的詹姆斯张,他付出了很多努力。

  • [extensions] 对AssociationProxy的一个很大的修复,以便多个AssociationProxy对象可以关联到一个关联集合。

  • [extensions] assign_mapper根据它们的键名称方法(即__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基于范围的访问,应用限制/偏移量:session.query(Foo)[3:5]
    • distinct() - 应用DISTINCT
    • list() - 评估标准并返回结果

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

  • [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] 查询具有add_entity()和add_column()生成方法。这些将在编译时将给定的mapper / class或ColumnElement添加到查询中,并将它们应用于instances()方法。用户负责构建合理的连接条件(否则您可以获得完整的笛卡尔产品)。结果集是元组的列表,不是唯一的。

  • [orm] 字符串和列也可以发送到实例()的* args,其中那些精确的结果列将成为结果元组的一部分。

  • [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] 急于加载不会通过除了渴望加载器本身之外的东西放置在选择语句中的“排序”“排序”来修复死亡列的可能性,如图所示。然而,这意味着你必须更加小心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] 添加了“刷新到期”级联。允许refresh()和expire()调用沿关系传播。

    参考文献:#492

  • [orm] more fixes to polymorphic relations, involving proper lazy-clause generation on many-to-one relationships to polymorphic mappers. 还修复了检测“方向”的问题,更专门针对属于多态联合的列与不联合的列。

    参考文献:#493

  • [orm] 当使用“viewonly = True”将其他表中的其他表拉入到关系的父/子映射的父关系中的连接条件时,修正了关系calc

  • [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] 对“使用B的集合清除对象A,但将C放入集合中”的错误条件 - 进行了积极的检查,即使C是B的子类< t2>,除非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与MetaData相同,但需要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 中仅固定使用2.4“颠倒”

    参考文献:#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] 设置为0时,case语句的“else_”参数现在可以正常工作。

MySQL的¶ T0>

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

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

预言¶ T0>

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

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

  • [oracle] 对于Oracle来说,auto_setinputsizes默认为True,它会错误地传播错误类型。

杂项¶ T0>

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

    参考文献:#472

  • [extensions] query()方法由assignmapper添加。这有助于导航到Query上的所有新生成方法。

  • [ms-sql]

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

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

  • [ms-sql] 带OFFSET的LIMIT现在引发错误(MS-SQL没有OFFSET支持)

  • [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] 现在在子查询中剥离了没有LIMIT的ORDER BY子句,因为MS-SQL禁止使用

  • [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] 另一个重构关系计算。允许更准确的ORM行为与映射器之间的/到/之间的关系,特别是多态映射器,以及它们与Query,SelectResults的用法。门票包括,null,null,

    References: #441, #448, #439

  • [orm] [bugs] 删除了在类上指定自定义集合的弃用方法;你现在必须使用“collection_class”选项。当人们使用assign_mapper()时,旧的方式开始产生冲突,现在它将“options”方法与名为“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] 改进了对嵌入到query.select()的“where”标准中的复杂查询的支持

    参考文献:#449

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

    参考文献:#485

  • [orm] [bugs] 修正了级联操作错误地在级联中包含已删除集合项的错误

    参考文献:#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')自动暗示eagerload('foo')

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

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

  • [orm] [enhancements] 增加了对“py2.5”的支持,以及“带有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] 固定参数传递给引擎上的直接文本execute(),连接。可以处理* args或位置列表实例,** kwargs或dict实例,用于指定参数,或列表或调用executemany()的列表或字典。

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

  • [sql] 在gmail 上修复了名为PrimaryKeyConstraint的代理礼让andrija

    参考文献:#466

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

    参考文献:#464

  • [sql] 修复tometadata()操作以在列和表级别传播约束

MySQL的¶ T0>

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

MSSQL ¶ T0>

  • [mssql] 初步支持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选项给表对象

    参考文献:#462

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

    参考文献:#467

0.3.4 ¶ T0>

发布日期:2007年1月23日

一般¶ T0>

  • [general] 全球“保险” - >“确保”更改。在美国英语中,“保险”实际上在很大程度上与“保证”(字典所说的)可以互换,所以我不是完全不识字的,但它确实是次优的,以确保它不含糊。< / T0>

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] 修正了删除孤儿基本上无法与多对多关系一起工作的问题,backref存在通常隐藏了症状

    参考文献:#427

  • [orm] 在映射器编译步骤中添加了一个互斥体。虽然不愿意向SA添加任何线程化的任何东西,但是这是一个真正需要的地方,因为映射器通常是“全局的”,虽然它们的状态在正常操作期间不会改变,但初始编译步骤会显着修改内部状态,这一步通常不是在模块级的初始化时间(除非你调用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] 修复了映射器刷新/过期中的错误,因此渴望的加载器没有正确地重新填充项目列表

    参考文献:#407

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

    参考文献:#413

  • [orm] 如果实际尝试修改实体上的主键值然后将其刷新,则会添加错误消息

    参考文献:#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] 另一个解决子查询相关性的问题,以便只有一个FROM元素的子查询将关联该单个元素,因为查询中至少需要一个FROM元素¶ T3>

  • [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] 类型的系统稍作修改以支持TypeDecorator,可以被方言覆盖(好吧,这不是很清楚,它允许下面的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] 创建约束的顺序首先在所有其他约束之前放置主键; firebird需要,对其他人来说不是一个坏主意

    参考文献:#408

  • [firebird] Firebird修复自动加载多字段外键

    参考文献:#409

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

    参考文献:#409

杂项¶ T0>

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

    参考文献:#424

  • [postgres] postgres有一个可选的“server_side_cursors = True”标志,它将使用服务器端游标。这些仅适用于获取部分结果,并且对于处理非常大的无限结果集是必需的。虽然我们希望这是默认行为,但不同的环境似乎有不同的结果,原因并未被隔离,所以我们现在默认关闭此功能。最近在psycopg邮件列表中发现了一个明显未公开的psycopg2行为。

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

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

    参考文献:#402

  • [extensions] 在assign_mapper中添加了“validate = False”参数,如果True将确保只映射的属性被命名为

    参考文献:#426

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

0.3.3 ¶ T0>

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

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

  • 添加了用于处理大型集合的示例/ 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不同步错误,还会阻止事务在所有DB中意外回滚

    参考文献:#387

  • 主要速度增强与0.3.1相比,使速度回到0.2.8级

  • 有条件地执行了数十个调试日志调用,这些调用耗时耗力以生成日志消息

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

  • 属性模块中的各种加速

  • Session中的身份映射默认为不再弱引用要使其引用较弱,请使用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

  • assignmapper扩展中的assign_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。(但不要向另一个方向传播)

  • 修复session.update()以保留传入对象的“脏”状态

  • 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”禁用保存更新级联的支持。

  • 在relation()中添加了“remote_side”参数,仅用于自引用映射器来强制父/子关系的方向。替换“切换”方向的“外键”参数的用法。“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] 调整重新生成的热切查询生成不会在循环加载关系中失败(如backrefs)

  • [orm] 修正了在生成LIMIT查询时eagerload()(也不是lazyload())选项没有正确指示查询是否使用“嵌套”的问题。 T2>

  • [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] 对query.count实现from_obj参数,改进了selectresults的count函数

    参考文献:#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] 新的扩展sqlalchemy.ext.associationproxy提供了透明的“关联对象”映射。新的示例examples / association / proxied_association.py说明。

  • [orm] 改进单个表继承以加载目标类下的完整层次结构

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

    参考文献:#362

  • [orm] 针对的拓扑排序,重构的额外返工

    参考文献:#365

  • [orm] 可以在多个父类上设置特定类型的“delete-orphan”;只有当它没有附加到那些父母的 时,该实例才是“孤儿”

杂项¶ T0>

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

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

  • [engine/pool] 固定直接执行编译对象

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

  • [databases/types] MySQL在“describe”上捕获异常并报告为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. “回声”关键字参数仍然有效,但为其各自的类/实例设置/取消设置日志级别。通过在“sqlalchemy”名称空间中为记录器设置INFO和DEBUG级别,可以通过Python API直接控制所有日志记录。类级别日志记录在“sqlalchemy。”下,在“sqlalchemy。.0x ..&lt; 00-FF>”下面的实例级日志记录下。 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] 对“属性加载器”和“选项”体系结构进行了广泛的重构。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:由于更改,MapperExtension上的append_result()和populate_instances()方法现在具有稍微不同的方法签名;希望这些方法还没有被广泛使用。

  • [orm] instances()方法现在移至Query,向后兼容版本保留在Mapper上。

  • [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] 将“viewonly”标志添加到relation(),允许构造对flush()过程没有影响的关系。

  • [orm] 在基本查询select / get函数中添加了“lockmode”参数,包括“with_lockmode”函数以获取具有默认锁定模式的Query副本。将“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()不会关闭它打开的连接

    参考文献:#346

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

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

  • [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] 改变了“for_update”参数以接受False / True /“nowait”和“read”,后两者仅由Oracle和Mysql解释T2>

    参考文献:#292

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

  • [sql] [construction] BooleanExpression包含新的“negate”参数,用于指定适当的否定运算符(如果有)。

  • [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] 增加了UniqueConstraint(进入表级),CheckConstraint(进入表级或列级)

  • [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对象具有处理复制和比较其特定类型值的方法。目前由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布尔数据类型将False / True转换为0/1

  • [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] 现在支持多列外键

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

  • [ms-sql] 添加了NCHAR和NVARCHAR类型支持

  • [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] 固定错误,其中Connection在commit / rollback后不会丢失事务

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