github sqlalchemy/sqlalchemy rel_2_0_36
2.0.36

one month ago

2.0.36

Released: October 15, 2024

orm

  • [orm] [usecase] Added new parameter _orm.mapped_column.hash to ORM constructs
    such as _orm.mapped_column(), _orm.relationship(), etc.,
    which is interpreted for ORM Native Dataclasses in the same way as other
    dataclass-specific field parameters.

    References: #11923

  • [orm] [bug] Fixed bug in ORM bulk update/delete where using RETURNING with bulk
    update/delete in combination with populate_existing would fail to
    accommodate the populate_existing option.

    References: #11912

  • [orm] [bug] Continuing from #11912, columns marked with
    mapped_column.onupdate,
    mapped_column.server_onupdate, or Computed are now
    refreshed in ORM instances when running an ORM enabled UPDATE with WHERE
    criteria, even if the statement does not use RETURNING or
    populate_existing.

    References: #11917

  • [orm] [bug] Fixed regression caused by fixes to joined eager loading in #11449
    released in 2.0.31, where a particular joinedload case could not be
    asserted correctly. We now have an example of that case so the assertion
    has been repaired to allow for it.

    References: #11965

  • [orm] [bug] Improved the error message emitted when trying to map as dataclass a class
    while also manually providing the __table__ attribute.
    This usage is currently not supported.

    References: #11973

  • [orm] [bug] Refined the check which the ORM lazy loader uses to detect "this would be
    loading by primary key and the primary key is NULL, skip loading" to take
    into account the current setting for the
    orm.Mapper.allow_partial_pks parameter. If this parameter is
    False, then a composite PK value that has partial NULL elements should
    also be skipped. This can apply to some composite overlapping foreign key
    configurations.

    References: #11995

  • [orm] [bug] Fixed bug in ORM "update with WHERE clause" feature where an explicit
    .returning() would interfere with the "fetch" synchronize strategy due
    to an assumption that the ORM mapped class featured the primary key columns
    in a specific position within the RETURNING. This has been fixed to use
    appropriate ORM column targeting.

    References: #11997

sql

  • [sql] [usecase] Datatypes that are binary based such as VARBINARY will resolve to
    LargeBinary when the TypeEngine.as_generic() method is
    called.

    References: #11978

  • [sql] [bug] [regression] Fixed regression from 1.4 where some datatypes such as those derived from
    TypeDecorator could not be pickled when they were part of a
    larger SQL expression composition due to internal supporting structures
    themselves not being pickleable.

    References: #12002

schema

  • [schema] [bug] Fixed bug where SQL functions passed to
    _schema.Column.server_default would not be rendered with the
    particular form of parenthesization now required by newer versions of MySQL
    and MariaDB. Pull request courtesy of huuya.

    References: #11317

postgresql

  • [postgresql] [bug] [reflection] Fixed bug in reflection of table comments where unrelated text would be
    returned if an entry in the pg_description table happened to share the
    same oid (objoid) as the table being reflected.

    References: #11961

  • [postgresql] [bug] The postgresql.JSON and postgresql.JSONB datatypes will
    now render a "bind cast" in all cases for all PostgreSQL backends,
    including psycopg2, whereas previously it was only enabled for some
    backends. This allows greater accuracy in allowing the database server to
    recognize when a string value is to be interpreted as JSON.

    References: #11994

mysql

  • [mysql] [performance] Improved a query used for the MySQL 8 backend when reflecting foreign keys
    to be better optimized. Previously, for a database that had millions of
    columns across all tables, the query could be prohibitively slow; the query
    has been reworked to take better advantage of existing indexes.

    References: #11975

Don't miss a new sqlalchemy release

NewReleases is sending notifications on new releases.