Skip to content

Releases: sqlalchemy/sqlalchemy

v1.1.2

02 Sep 19:08
Compare
Choose a tag to compare

1.1.2

Released: October 17, 2016

orm

  • [orm] [bug] Fixed bug involving the rule to disable a joined collection eager
    loader on the other side of a many-to-one lazy loader, first added
    in #1495, where the rule would fail if the parent object
    had some other lazyloader-bound query options associated with it.

    References: #3824

  • [orm] [bug] Fixed self-referential entity, deferred column loading issue in a
    similar style as that of #3431, #3811 where an entity
    is present in multiple positions within the row due to self-referential
    eager loading; when the deferred loader only applies to one of the
    paths, the "present" column loader will now override the deferred non-
    load for that entity regardless of row ordering.

    References: #3822

sql

  • [sql] [bug] Fixed a regression caused by a newly added function that performs the
    "wrap callable" function of sql DefaultGenerator objects,
    an attribute error raised for __module__ when the default callable
    was a functools.partial or other object that doesn't have a
    __module__ attribute.

    References: #3823

  • [sql] [bug] [postgresql] Fixed regression in Enum type where event handlers were not
    transferred in the case of the type object being copied, due to a
    conflicting copy() method added as part of #3250. This copy
    occurs normally in situations when the column is copied, such as
    in tometadata() or when using declarative mixins with columns. The
    event handler not being present would impact the constraint being
    created for a non-native enumerated type, but more critically the
    ENUM object on the PostgreSQL backend.

    References: #3827

postgresql

  • [postgresql] [bug] [sql] Changed the naming convention used when generating bound parameters
    for a multi-VALUES insert statement, so that the numbered parameter
    names don't conflict with the anonymized parameters of a WHERE clause,
    as is now common in a PostgreSQL ON CONFLICT construct.

    References: #3828

v1.1.1

02 Sep 19:08
Compare
Choose a tag to compare

1.1.1

Released: October 7, 2016

mssql

  • [mssql] [bug] The "SELECT SERVERPROPERTY"
    query added in #3810 and #3814 is failing on unknown
    combinations of Pyodbc and SQL Server. While failure of this function
    was anticipated, the exception catch was not broad enough so it now
    catches all forms of pyodbc.Error.

    References: #3820

misc

  • [bug] [core] Changed the CompileError raised when various primary key missing
    situations are detected to a warning. The statement is again
    passed to the database where it will fail and the DBAPI error (usually
    IntegrityError) raises as usual.

    References: #3216

v1.1.0

02 Sep 19:08
Compare
Choose a tag to compare

1.1.0

Released: October 5, 2016

orm

  • [orm] [bug] Fixed bug where joined eager loading would fail for a polymorphically-
    loaded mapper, where the polymorphic_on was set to an un-mapped
    expression such as a CASE expression.

    This change is also backported to: 1.0.16

    References: #3800

  • [orm] [bug] Fixed bug where the ArgumentError raised for an invalid bind
    sent to a Session via Session.bind_mapper(),
    Session.bind_table(),
    or the constructor would fail to be correctly raised.

    This change is also backported to: 1.0.16

    References: #3798

  • [orm] [bug] Fixed bug in subquery eager loading where a subqueryload
    of an "of_type()" object linked to a second subqueryload of a plain
    mapped class, or a longer chain of several "of_type()" attributes,
    would fail to link the joins correctly.

    This change is also backported to: 1.0.15

    References: #3773, #3774

  • [orm] [bug] ORM attributes can now be assigned any object that is has a
    __clause_element__() attribute, which will result in inline
    SQL the way any ClauseElement class does. This covers other
    mapped attributes not otherwise transformed by further expression
    constructs.

    References: #3802

  • [orm] [feature] Enhanced the new "raise" lazy loader strategy to also include a
    "raise_on_sql" variant, available both via orm.relationship.lazy
    as well as orm.raiseload(). This variant only raises if the
    lazy load would actually emit SQL, vs. raising if the lazy loader
    mechanism is invoked at all.

    References: #3812

  • [orm] [bug] Made an adjustment to the bug fix first introduced in [ticket:3431]
    that involves an object appearing in multiple contexts in a single
    result set, such that an eager loader that would set the related
    object value to be None will still fire off, thus satisfying the
    load of that attribute. Previously, the adjustment only honored
    a non-None value arriving for an eagerly loaded attribute in a
    secondary row.

    References: #3811

  • [orm] [bug] Fixed bug in new SessionEvents.persistent_to_deleted() event
    where the target object could be garbage collected before the event
    is fired off.

    References: #3808

  • [orm] [bug] The primaryjoin of a relationship() construct can now include
    a bindparam() object that includes a callable function to
    generate values. Previously, the lazy loader strategy would
    be incompatible with this use, and additionally would fail to correctly
    detect if the "use_get" criteria should be used if the primary key
    were involved with the bound parameter.

    References: #3767

  • [orm] [bug] An UPDATE emitted from the ORM flush process can now accommodate a
    SQL expression element for a column within the primary key of an
    object, if the target database supports RETURNING in order to provide
    the new value, or if the PK value is set "to itself" for the purposes
    of bumping some other trigger / onupdate on the column.

    References: #3801

  • [orm] [bug] Fixed bug where the "simple many-to-one" condition that allows lazy
    loading to use get() from identity map would fail to be invoked if the
    primaryjoin of the relationship had multiple clauses separated by AND
    which were not in the same order as that of the primary key columns
    being compared in each clause. This ordering
    difference occurs for a composite foreign key where the table-bound
    columns on the referencing side were not in the same order in the .c
    collection as the primary key columns on the referenced side....which
    in turn occurs a lot if one is using declarative mixins and/or
    declared_attr to set up columns.

    References: #3788

  • [orm] [bug] An exception is raised when two @validates decorators on a mapping
    make use of the same name. Only one validator of a certain name
    at a time is supported, there's no mechanism to chain these together,
    as the order of the validators at the level of function decorator
    can't be made deterministic.

    References: #3776

  • [orm] [bug] Mapper errors raised during configure_mappers() now explicitly
    include the name of the originating mapper in the exception message
    to help in those situations where the wrapped exception does not
    itself include the source mapper. Pull request courtesy
    John Perkins.

  • [orm] [change] Passing False to Query.order_by() in order to cancel
    all order by's is deprecated; there is no longer any difference
    between calling this method with False or with None.

  • [orm] [feature] The Query.group_by() method now resets the group by collection
    if an argument of None is passed, in the same way that
    Query.order_by() has worked for a long time. Pull request
    courtesy Iuri Diniz.

orm declarative

  • [change] [declarative] [orm] Constructing a declarative base class that inherits from another class
    will also inherit its docstring. This means
    ~.ext.declarative.as_declarative() acts more like a normal class
    decorator.

sql

  • [sql] [bug] Fixed bug in Table where the internal method
    _reset_exported() would corrupt the state of the object. This
    method is intended for selectable objects and is called by the ORM
    in some cases; an erroneous mapper configuration would could lead the
    ORM to call this on a Table object.

    This change is also backported to: 1.0.15

    References: #3755

  • [sql] [bug] Execution options can now be propagated from within a
    statement at compile time to the outermost statement, so that
    if an embedded element wants to set "autocommit" to be True for example,
    it can propagate this to the enclosing statement. Currently, this
    feature is enabled for a DML-oriented CTE embedded inside of a SELECT
    statement, e.g. INSERT/UPDATE/DELETE inside of SELECT.

    References: #3805

  • [sql] [bug] A string sent as a column default via the
    Column.server_default parameter is now escaped for quotes.

    References: #3809

  • [sql] [bug] [postgresql] Added compiler-level flags used by PostgreSQL to place additional
    parenthesis than would normally be generated by precedence rules
    around operations involving JSON, HSTORE indexing operators as well as
    within their operands since it has been observed that PostgreSQL's
    precedence rules for at least the HSTORE indexing operator is not
    consistent between 9.4 and 9.5.

    References: #3806

  • [sql] [bug] [mysql] The BaseException exception class is now intercepted by the
    exception-handling routines of Connection, and includes
    handling by the ~.ConnectionEvents.handle_error()
    event. The Connection is now invalidated by default in
    the case of a system level exception that is not a subclass of
    Exception, including KeyboardInterrupt and the greenlet
    GreenletExit class, to prevent further operations from occurring
    upon a database connection that is in an unknown and possibly
    corrupted state. The MySQL drivers are most targeted by this change
    however the change is across all DBAPIs.

    References: #3803

  • [sql] [bug] The "eq" and "ne" operators are no longer part of the list of
    "associative" operators, while they remain considered to be
    "commutative". This allows an expression like (x == y) == z
    to be maintained at the SQL level with parenthesis. Pull request
    courtesy John Passaro.

    References: #3799

  • [sql] [bug] Stringify of expression with unnamed Column objects, as
    occurs in lots of situations including ORM error reporting,
    will now render the name in string context as ""
    rather than raising a compile error.

    References: #3789

  • [sql] [bug] Raise a more descriptive exception / message when ClauseElement
    or non-SQLAlchemy objects that are not "executable" are erroneously
    passed to .execute(); a new exception ObjectNotExecutableError
    is raised consistently in all cases.

    References: #3786

  • [sql] [bug] [mysql] [postgresql] Fixed regression in JSON datatypes where the "literal processor" for
    a JSON index value would not be invoked. The native String and Integer
    datatypes are now called upon from within the JSONIndexType
    and JSONPathType. This is applied to the generic, PostgreSQL, and
    MySQL JSON types and also has a dependency on #3766.

    References: #3765

  • [sql] [bug] Fixed bug where Index would fail to extract columns from
    compound SQL expressions if those SQL expressions were wrapped inside
    of an ORM-style __clause_element__() construct. This bug
    exists in 1.0.x as well, howev...

Read more

v1.1.0b3

02 Sep 19:08
Compare
Choose a tag to compare
v1.1.0b3 Pre-release
Pre-release

1.1.0b3

Released: July 26, 2016

orm

  • [orm] [change] Removed a warning that dates back to 0.4 which emits when a same-named
    relationship is placed on two mappers that inherits via joined or
    single table inheritance. The warning does not apply to the
    current unit of work implementation.

    References: #3749

sql

  • [sql] [bug] Fixed bug in new CTE feature for update/insert/delete stated
    as a CTE inside of an enclosing statement (typically SELECT) whereby
    oninsert and onupdate values weren't called upon for the embedded
    statement.

    References: #3745

  • [sql] [bug] Fixed bug in new CTE feature for update/insert/delete whereby
    an anonymous (e.g. no name passed) CTE construct around
    the statement would fail.

    References: #3744

postgresql

  • [postgresql] [bug] Fixed bug whereby TypeDecorator and Variant
    types were not deeply inspected enough by the PostgreSQL dialect
    to determine if SMALLSERIAL or BIGSERIAL needed to be rendered
    rather than SERIAL.

    This change is also backported to: 1.0.14

    References: #3739

oracle

  • [oracle] [bug] Fixed bug in Select.with_for_update.of, where the Oracle
    "rownum" approach to LIMIT/OFFSET would fail to accommodate for the
    expressions inside the "OF" clause, which must be stated at the topmost
    level referring to expression within the subquery. The expressions are
    now added to the subquery if needed.

    This change is also backported to: 1.0.14

    References: #3741

misc

  • [bug] [ext] Fixed bug in sqlalchemy.ext.baked where the unbaking of a
    subquery eager loader query would fail due to a variable scoping
    issue, when multiple subquery loaders were involved. Pull request
    courtesy Mark Hahnenberg.

    This change is also backported to: 1.0.15

    References: #3743

  • [bug] [ext] sqlalchemy.ext.indexable will intercept IndexError as well
    as KeyError when raising as AttributeError.

  • [ext] [feature] Added a "default" parameter to the new sqlalchemy.ext.indexable
    extension.

v1.1.0b2

02 Sep 19:08
Compare
Choose a tag to compare
v1.1.0b2 Pre-release
Pre-release

1.1.0b2

Released: July 1, 2016

sql

  • [sql] [bug] Fixed issue in SQL math negation operator where the type of the
    expression would no longer be the numeric type of the original.
    This would cause issues where the type determined result set
    behaviors.

    This change is also backported to: 1.0.14

    References: #3735

  • [sql] [bug] Fixed bug whereby the __getstate__ / __setstate__
    methods for sqlalchemy.util.Properties were
    non-working due to the transition in the 1.0 series to __slots__.
    The issue potentially impacted some third-party applications.
    Pull request courtesy Pieter Mulder.

    This change is also backported to: 1.0.14

    References: #3728

  • [sql] [bug] The processing performed by the Boolean datatype for backends
    that only feature integer types has been made consistent between the
    pure Python and C-extension versions, in that the C-extension version
    will accept any integer value from the database as a boolean, not just
    zero and one; additionally, non-boolean integer values being sent to
    the database are coerced to exactly zero or one, instead of being
    passed as the original integer value.

    References: #3730

  • [sql] [bug] Rolled back the validation rules a bit in Enum to allow
    unknown string values to pass through, unless the flag
    validate_string=True is passed to the Enum; any other kind of object is
    still of course rejected. While the immediate use
    is to allow comparisons to enums with LIKE, the fact that this
    use exists indicates there may be more unknown-string-comparison use
    cases than we expected, which hints that perhaps there are some
    unknown string-INSERT cases too.

    References: #3725

postgresql

  • [postgresql] [bug] [ext] Made a slight behavioral change in the sqlalchemy.ext.compiler
    extension, whereby the existing compilation schemes for an established
    construct would be removed if that construct itself didn't already
    have its own dedicated __visit_name__. This was a
    rare occurrence in 1.0, however in 1.1 postgresql.ARRAY
    subclasses sqltypes.ARRAY and has this behavior.
    As a result, setting up a compilation handler for another dialect
    such as SQLite would render the main postgresql.ARRAY
    object no longer compilable.

    References: #3732

mysql

  • [mysql] [bug] Dialed back the "order the primary key columns per auto-increment"
    described in change_mysql_3216 a bit, so that if the
    PrimaryKeyConstraint is explicitly defined, the order
    of columns is maintained exactly, allowing control of this behavior
    when necessary.

    References: #3726

v1.1.0b1

02 Sep 19:08
Compare
Choose a tag to compare
v1.1.0b1 Pre-release
Pre-release

1.1.0b1

Released: June 16, 2016

orm

  • [orm] [ext] [feature] A new ORM extension indexable_toplevel is added, which allows
    construction of Python attributes which refer to specific elements
    of "indexed" structures such as arrays and JSON fields. Pull request
    courtesy Jeong YunWon.

  • [orm] [bug] Fixed an issue where a many-to-one change of an object from one
    parent to another could work inconsistently when combined with
    an un-flushed modification of the foreign key attribute. The attribute
    move now considers the database-committed value of the foreign key
    in order to locate the "previous" parent of the object being
    moved. This allows events to fire off correctly including
    backref events. Previously, these events would not always fire.
    Applications which may have relied on the previously broken
    behavior may be affected.

    References: #3708

  • [orm] [feature] Added new flag Session.bulk_insert_mappings.render_nulls
    which allows an ORM bulk INSERT to occur with NULL values rendered;
    this bypasses server side defaults, however allows all statements
    to be formed with the same set of columns, allowing them to be
    batched. Pull request courtesy Tobias Sauerwein.

  • [orm] [feature] Added new event AttributeEvents.init_scalar(), as well
    as a new example suite illustrating its use. This event can be used
    to provide a Core-generated default value to a Python-side attribute
    before the object is persisted.

    References: #1311

  • [orm] [feature] Added AutomapBase.prepare.schema to the
    AutomapBase.prepare() method, to indicate which schema
    tables should be reflected from if not the default schema.
    Pull request courtesy Josh Marlow.

  • [orm] [change] The Mapper.order_by parameter is deprecated.
    This is an old parameter no longer relevant to how SQLAlchemy
    works, once the Query object was introduced. By deprecating it
    we establish that we aren't supporting non-working use cases
    and that we encourage applications to move off of the use of this
    parameter.

    References: #3394

  • [orm] [bug] Fixed bug where deferred columns would inadvertently be set up
    for database load on the next object-wide unexpire, when the object
    were merged into the session with session.merge(obj, load=False).

    References: #3488

  • [orm] [bug] [mysql] Further continuing on the common MySQL exception case of
    a savepoint being cancelled first covered in #2696,
    the failure mode in which the Session is placed when a
    SAVEPOINT vanishes before rollback has been improved to allow the
    Session to still function outside of that savepoint.
    It is assumed that the savepoint operation failed and was cancelled.

    References: #3680

  • [orm] [bug] Fixed bug where a newly inserted instance that is rolled back
    would still potentially cause persistence conflicts on the next
    transaction, because the instance would not be checked that it
    was expired. This fix will resolve a large class of cases that
    erroneously cause the "New instance with identity X conflicts with
    persistent instance Y" error.

    References: #3677

  • [orm] [bug] An improvement to the workings of Query.correlate() such
    that when a "polymorphic" entity is used which represents a straight
    join of several tables, the statement will ensure that all the
    tables within the join are part of what's correlating.

    References: #3662

  • [orm] [bug] Fixed bug which would cause an eagerly loaded many-to-one attribute
    to not be loaded, if the joined eager load were from a row where the
    same entity were present multiple times, some calling for the attribute
    to be eagerly loaded and others not. The logic here is revised to
    take in the attribute even though a different loader path has
    handled the parent entity already.

    References: #3431

  • [orm] [bug] A refinement to the logic which adds columns to the resulting SQL when
    Query.distinct() is combined with Query.order_by() such
    that columns which are already present will not be added
    a second time, even if they are labeled with a different name.
    Regardless of this change, the extra columns added to the SQL have
    never been returned in the final result, so this change only impacts
    the string form of the statement as well as its behavior when used in
    a Core execution context. Additionally, columns are no longer added
    when the DISTINCT ON format is used, provided the query is not
    wrapped inside a subquery due to joined eager loading.

    References: #3641

  • [orm] [feature] Added new parameter orm.mapper.passive_deletes to
    available mapper options. This allows a DELETE to proceed
    for a joined-table inheritance mapping against the base table only,
    while allowing for ON DELETE CASCADE to handle deleting the row
    from the subclass tables.

    References: #2349

  • [orm] [feature] Calling str() on a core SQL construct has been made more "friendly",
    when the construct contains non-standard SQL elements such as
    RETURNING, array index operations, or dialect-specific or custom
    datatypes. A string is now returned in these cases rendering an
    approximation of the construct (typically the PostgreSQL-style
    version of it) rather than raising an error.

    References: #3631

  • [orm] [bug] Fixed issue where two same-named relationships that refer to
    a base class and a concrete-inherited subclass would raise an error
    if those relationships were set up using "backref", while setting up the
    identical configuration using relationship() instead with the conflicting
    names would succeed, as is allowed in the case of a concrete mapping.

    References: #3630

  • [orm] [feature] The str() call for Query will now take into account
    the Engine to which the Session is bound, when
    generating the string form of the SQL, so that the actual SQL
    that would be emitted to the database is shown, if possible. Previously,
    only the engine associated with the MetaData to which the
    mappings are associated would be used, if present. If
    no bind can be located either on the Session or on
    the MetaData to which the mappings are associated, then
    the "default" dialect is used to render the SQL, as was the case
    previously.

    References: #3081

  • [orm] [bug] The Session.merge() method now tracks pending objects by
    primary key before emitting an INSERT, and merges distinct objects with
    duplicate primary keys together as they are encountered, which is
    essentially semi-deterministic at best. This behavior
    matches what happens already with persistent objects.

    References: #3601

  • [orm] [bug] Fixed bug where the "single table inheritance" criteria would be
    added onto the end of a query in some inappropriate situations, such
    as when querying from an exists() of a single-inheritance subclass.

    References: #3582

  • [orm] [bug] Added a new type-level modifier TypeEngine.evaluates_none()
    which indicates to the ORM that a positive set of None should be
    persisted as the value NULL, instead of omitting the column from
    the INSERT statement. This feature is used both as part of the
    implementation for #3514 as well as a standalone feature
    available on any type.

    References: #3250

  • [orm] [bug] Internal calls to "bookkeeping" functions within
    Session.bulk_save_objects() and related bulk methods have
    been scaled back to the extent that this functionality is not
    currently used, e.g. checks for column default values to be
    fetched after an INSERT or UPDATE statement.

    References: #3526

  • [orm] [feature] The SessionEvents suite now includes events to allow
    unambiguous tracking of all object lifecycle state transitions
    in terms of the Session itself, e.g. pending,
    transient, persistent, detached. The state of the object
    within each event is also defined.

    References: #2677

  • [orm] [feature] Added a new session lifecycle state :term:deleted. This new state
    represents an object that has been deleted from the :term:persistent
    state and will move to the :term:detached state once the transaction
    is committed. This resolves the long-standing issue that objects
    which were deleted existed in a gray area between persistent and
    detached. The InstanceState.persistent accessor will
    no longer report on a deleted object as persistent; the
    InstanceState.deleted accessor will instead be True for
    these objects, until they become detached.

    Unknown interpreted text role "term".

    Unknown interpreted text role "term".

    Unknown interpreted text role "term".

    References: [#2677](http...

Read more