github sqlalchemy/sqlalchemy rel_1_3_0b2
1.3.0b2

1.3.0b2

Released: January 25, 2019

  • [bug] [ext] Fixed a regression in 1.3.0b1 caused by #3423 where association
    proxy objects that access an attribute that's only present on a polymorphic
    subclass would raise an AttributeError even though the actual instance
    being accessed was an instance of that subclass.

    References: #4401

  • [bug] [orm] Fixed long-standing issue where duplicate collection members would cause a
    backref to delete the association between the member and its parent object
    when one of the duplicates were removed, as occurs as a side effect of
    swapping two objects in one statement.

    References: #1103

  • [bug] [mssql] The literal_processor for the Unicode and
    UnicodeText datatypes now render an N character in front of
    the literal string expression as required by SQL Server for Unicode string
    values rendered in SQL expressions.

    References: #4442

  • [feature] [orm] Implemented a new feature whereby the AliasedClass construct can
    now be used as the target of a relationship(). This allows the
    concept of "non primary mappers" to no longer be necessary, as the
    AliasedClass is much easier to configure and automatically inherits
    all the relationships of the mapped class, as well as preserves the
    ability for loader options to work normally.

    References: #4423

  • [bug] [orm] Extended the fix first made as part of #3287, where a loader option
    made against a subclass using a wildcard would extend itself to include
    application of the wildcard to attributes on the super classes as well, to a
    "bound" loader option as well, e.g. in an expression like
    Load(SomeSubClass).load_only('foo'). Columns that are part of the
    parent class of SomeSubClass will also be excluded in the same way as if
    the unbound option load_only('foo') were used.

    References: #4373

  • [bug] [orm] Improved error messages emitted by the ORM in the area of loader option
    traversal. This includes early detection of mis-matched loader strategies
    along with a clearer explanation why these strategies don't match.

    References: #4433

  • [change] [orm] Added a new function close_all_sessions() which takes
    over the task of the Session.close_all() method, which
    is now deprecated as this is confusing as a classmethod.
    Pull request courtesy Augustin Trancart.

    References: #4412

  • [feature] [orm] Added new MapperEvents.before_mapper_configured() event. This
    event complements the other "configure" stage mapper events with a per
    mapper event that receives each Mapper right before its
    configure step, and additionally may be used to prevent or delay the
    configuration of specific Mapper objects using a new
    return value orm.interfaces.EXT_SKIP. See the
    documentation link for an example.

    References: #4397

  • [bug] [orm] The "remove" event for collections is now called before the item is removed
    in the case of the collection.remove() method, as is consistent with the
    behavior for most other forms of collection item removal (such as
    __delitem__, replacement under __setitem__). For pop() methods,
    the remove event still fires after the operation.

  • [bug] [orm declarative] Added a __clause_element__() method to ColumnProperty which
    can allow the usage of a not-fully-declared column or deferred attribute in
    a declarative mapped class slightly more friendly when it's used in a
    constraint or other column-oriented scenario within the class declaration,
    though this still can't work in open-ended expressions; prefer to call the
    ColumnProperty.expression attribute if receiving TypeError.

    References: #4372

  • [bug] [engine] [orm] Added accessors for execution options to Core and ORM, via
    Query.get_execution_options(),
    Connection.get_execution_options(),
    Engine.get_execution_options(), and
    Executable.get_execution_options(). PR courtesy Daniel Lister.

    References: #4464

  • [bug] [orm] Fixed issue in association proxy due to #3423 which caused the use
    of custom PropComparator objects with hybrid attributes, such as
    the one demonstrated in the dictlike-polymorphic example to not
    function within an association proxy. The strictness that was added in
    #3423 has been relaxed, and additional logic to accommodate for
    an association proxy that links to a custom hybrid have been added.

    References: #4446

  • [change] [general] A large change throughout the library has ensured that all objects,
    parameters, and behaviors which have been noted as deprecated or legacy now
    emit DeprecationWarning warnings when invoked.As the Python 3
    interpreter now defaults to displaying deprecation warnings, as well as that
    modern test suites based on tools like tox and pytest tend to display
    deprecation warnings, this change should make it easier to note what API
    features are obsolete. A major rationale for this change is so that long-
    deprecated features that nonetheless still see continue to see real world
    use can finally be removed in the near future; the biggest example of this
    are the SessionExtension and MapperExtension classes as
    well as a handful of other pre-event extension hooks, which have been
    deprecated since version 0.7 but still remain in the library. Another is
    that several major longstanding behaviors are to be deprecated as well,
    including the threadlocal engine strategy, the convert_unicode flag, and non
    primary mappers.

    References: #4393

  • [change] [engine] The "threadlocal" engine strategy which has been a legacy feature of
    SQLAlchemy since around version 0.2 is now deprecated, along with the
    Pool.threadlocal parameter of Pool which has no
    effect in most modern use cases.

    References: #4393

  • [change] [sql] The create_engine.convert_unicode and
    String.convert_unicode parameters have been deprecated. These
    parameters were built back when most Python DBAPIs had little to no support
    for Python Unicode objects, and SQLAlchemy needed to take on the very
    complex task of marshalling data and SQL strings between Unicode and
    bytestrings throughout the system in a performant way. Thanks to Python 3,
    DBAPIs were compelled to adapt to Unicode-aware APIs and today all DBAPIs
    supported by SQLAlchemy support Unicode natively, including on Python 2,
    allowing this long-lived and very complicated feature to finally be (mostly)
    removed. There are still of course a few Python 2 edge cases where
    SQLAlchemy has to deal with Unicode however these are handled automatically;
    in modern use, there should be no need for end-user interaction with these
    flags.

    References: #4393

  • [bug] [orm] Implemented the .get_history() method, which also implies availability
    of AttributeState.history, for synonym() attributes.
    Previously, trying to access attribute history via a synonym would raise an
    AttributeError.

    References: #3777

  • [engine] [feature] Added public accessor QueuePool.timeout() that returns the configured
    timeout for a QueuePool object. Pull request courtesy Irina Delamare.

    References: #3689

  • [feature] [sql] Amended the AnsiFunction class, the base of common SQL
    functions like CURRENT_TIMESTAMP, to accept positional arguments
    like a regular ad-hoc function. This to suit the case that many of
    these functions on specific backends accept arguments such as
    "fractional seconds" precision and such. If the function is created
    with arguments, it renders the parenthesis and the arguments. If
    no arguments are present, the compiler generates the non-parenthesized form.

    References: #4386

latest releases: rel_1_3_20, rel_1_3_19, rel_1_3_18...
pre-release13 months ago