github sqlalchemy/sqlalchemy rel_1_4_18
1.4.18

latest releases: rel_2_0_35, rel_1_4_54, rel_2_0_34...
3 years ago

1.4.18

Released: June 10, 2021

orm

  • [orm] [performance] [bug] [regression] Fixed regression involving how the ORM would resolve a given mapped column
    to a result row, where under cases such as joined eager loading, a slightly
    more expensive "fallback" could take place to set up this resolution due to
    some logic that was removed since 1.3. The issue could also cause
    deprecation warnings involving column resolution to be emitted when using a
    1.4 style query with joined eager loading.

    References: #6596

  • [orm] [bug] Clarified the current purpose of the
    _orm.relationship.bake_queries flag, which in 1.4 is to enable
    or disable "lambda caching" of statements within the "lazyload" and
    "selectinload" loader strategies; this is separate from the more
    foundational SQL query cache that is used for most statements.
    Additionally, the lazy loader no longer uses its own cache for many-to-one
    SQL queries, which was an implementation quirk that doesn't exist for any
    other loader scenario. Finally, the "lru cache" warning that the lazyloader
    and selectinloader strategies could emit when handling a wide array of
    class/relationship combinations has been removed; based on analysis of some
    end-user cases, this warning doesn't suggest any significant issue. While
    setting bake_queries=False for such a relationship will remove this
    cache from being used, there's no particular performance gain in this case
    as using no caching vs. using a cache that needs to refresh often likely
    still wins out on the caching being used side.

    References: #6072, #6487

  • [orm] [bug] [regression] Adjusted the means by which classes such as _orm.scoped_session
    and _asyncio.AsyncSession are generated from the base
    _orm.Session class, such that custom _orm.Session
    subclasses such as that used by Flask-SQLAlchemy don't need to implement
    positional arguments when they call into the superclass method, and can
    continue using the same argument styles as in previous releases.

    References: #6285

  • [orm] [bug] [regression] Fixed issue where query production for joinedload against a complex left
    hand side involving joined-table inheritance could fail to produce a
    correct query, due to a clause adaption issue.

    References: #6595

  • [orm] [bug] Fixed issue in experimental "select ORM objects from INSERT/UPDATE" use
    case where an error was raised if the statement were against a
    single-table-inheritance subclass.

    References: #6591

  • [orm] [bug] The warning that's emitted for _orm.relationship() when multiple
    relationships would overlap with each other as far as foreign key
    attributes written towards, now includes the specific "overlaps" argument
    to use for each warning in order to silence the warning without changing
    the mapping.

    References: #6400

asyncio

  • [asyncio] [usecase] Implemented a new registry architecture that allows the Async version
    of an object, like AsyncSession, AsyncConnection, etc., to be
    locatable given the proxied "sync" object, i.e. Session,
    Connection. Previously, to the degree such lookup functions were used,
    an Async object would be re-created each time, which was less than
    ideal as the identity and state of the "async" object would not be
    preserved across calls.

    From there, new helper functions _asyncio.async_object_session(),
    _asyncio.async_session() as well as a new _orm.InstanceState
    attribute _orm.InstanceState.async_session have been added, which
    are used to retrieve the original _asyncio.AsyncSession associated
    with an ORM mapped object, a _orm.Session associated with an
    _asyncio.AsyncSession, and an _asyncio.AsyncSession
    associated with an _orm.InstanceState, respectively.

    This patch also implements new methods
    _asyncio.AsyncSession.in_nested_transaction(),
    _asyncio.AsyncSession.get_transaction(),
    _asyncio.AsyncSession.get_nested_transaction().

    References: #6319

  • [asyncio] [bug] Fixed an issue that presented itself when using the _pool.NullPool
    or the _pool.StaticPool with an async engine. This mostly affected
    the aiosqlite dialect.

    References: #6575

  • [asyncio] [bug] Added asyncio.exceptions.TimeoutError,
    asyncio.exceptions.CancelledError as so-called "exit exceptions", a
    class of exceptions that include things like GreenletExit and
    KeyboardInterrupt, which are considered to be events that warrant
    considering a DBAPI connection to be in an unusable state where it should
    be recycled.

    References: #6592

postgresql

  • [postgresql] [bug] [regression] Fixed regression where using the PostgreSQL "INSERT..ON CONFLICT" structure
    would fail to work with the psycopg2 driver if it were used in an
    "executemany" context along with bound parameters in the "SET" clause, due
    to the implicit use of the psycopg2 fast execution helpers which are not
    appropriate for this style of INSERT statement; as these helpers are the
    default in 1.4 this is effectively a regression. Additional checks to
    exclude this kind of statement from that particular extension have been
    added.

    References: #6581

sqlite

  • [sqlite] [bug] Add note regarding encryption-related pragmas for pysqlcipher passed in the
    url.

    This change is also backported to: 1.3.25

    References: #6589

  • [sqlite] [bug] [regression] The fix for pysqlcipher released in version 1.4.3 #5848 was
    unfortunately non-working, in that the new on_connect_url hook was
    erroneously not receiving a URL object under normal usage of
    _sa.create_engine() and instead received a string that was unhandled;
    the test suite failed to fully set up the actual conditions under which
    this hook is called. This has been fixed.

    References: #6586

Don't miss a new sqlalchemy release

NewReleases is sending notifications on new releases.