Mike Bayer [Tue, 21 Apr 2015 14:04:02 +0000 (10:04 -0400)]
- Added the string value ``"none"`` to those accepted by the
:paramref:`.Pool.reset_on_return` parameter as a synonym for ``None``,
so that string values can be used for all settings, allowing
.ini file utilities like :func:`.engine_from_config` to be usable
without issue.
fixes #3375
Mike Bayer [Mon, 20 Apr 2015 23:21:00 +0000 (19:21 -0400)]
- Fixed issue where a straight SELECT EXISTS query would fail to
assign the proper result type of Boolean to the result mapping, and
instead would leak column types from within the query into the
result map. This issue exists in 0.9 and earlier as well, however
has less of an impact in those versions. In 1.0, due to #918
this becomes a regression in that we now rely upon the result mapping
to be very accurate, else we can assign result-type processors to
the wrong column. In all versions, this issue also has the effect
that a simple EXISTS will not apply the Boolean type handler, leading
to simple 1/0 values for backends without native boolean instead of
True/False. The fix includes that an EXISTS columns argument
will be anon-labeled like other column expressions; a similar fix is
implemented for pure-boolean expressions like ``not_(True())``.
fixes #3372
Mike Bayer [Mon, 20 Apr 2015 21:38:03 +0000 (17:38 -0400)]
- Fixed more regressions caused by NEVER_SET; comparisons
to transient objects with attributes unset would leak NEVER_SET,
and negated_contains_or_equals would do so for any transient
object as the comparison used only the committed value.
Repaired the NEVER_SET cases, fixes #3371, and also made
negated_contains_or_equals() use state_attr_by_column() just
like a non-negated comparison, fixes #3374
Mike Bayer [Fri, 17 Apr 2015 20:06:04 +0000 (16:06 -0400)]
- Fixed a critical regression caused by :ticket:`3061` where the
NEVER_SET symbol could easily leak into a lazyload query, subsequent
to the flush of a pending object. This would occur typically
for a many-to-one relationship that does not use a simple
"get" strategy. The good news is that the fix improves efficiency
vs. 0.9, because we can now skip the SELECT statement entirely
when we detect NEVER_SET symbols present in the parameters; prior to
:ticket:`3061`, we couldn't discern if the None here were set or not.
fixes #3368
Mike Bayer [Wed, 15 Apr 2015 21:30:23 +0000 (17:30 -0400)]
- Identified an inconsistency when handling :meth:`.Query.join` to the
same target more than once; it implicitly dedupes only in the case of
a relationship join, and due to :ticket:`3233`, in 1.0 a join
to the same table twice behaves differently than 0.9 in that it no
longer erroneously aliases. To help document this change,
the verbiage regarding :ticket:`3233` in the migration notes has
been generalized, and a warning has been added when :meth:`.Query.join`
is called against the same target relationship more than once.
fixes #3367
Mike Bayer [Sun, 12 Apr 2015 17:45:08 +0000 (13:45 -0400)]
- Made a small improvement to the heuristics of relationship when
determining remote side with semi-self-referential (e.g. two joined
inh subclasses referring to each other), non-simple join conditions
such that the parententity is taken into account and can reduce the
need for using the ``remote()`` annotation; this can restore some
cases that might have worked without the annotation prior to 0.9.4
via :ticket:`2948`. fixes #3364
Mike Bayer [Fri, 10 Apr 2015 15:20:14 +0000 (11:20 -0400)]
- Fixed issue where a :class:`.MetaData` object that used a naming
convention would not properly work with pickle. The attribute was
skipped leading to inconsistencies and failures if the unpickled
:class:`.MetaData` object were used to base additional tables
from.
fixes #3362
Mike Bayer [Wed, 8 Apr 2015 16:14:56 +0000 (12:14 -0400)]
- ensure that the keys we put into the parameters dictionary
for an insert from select are the string names, and not
the Column objects. The MSSQL dialect in particular relies upon
checking for these keys in params to know if identity insert
should be on. references #3360
Mike Bayer [Wed, 8 Apr 2015 15:59:12 +0000 (11:59 -0400)]
- Fixed a regression where the "last inserted id" mechanics would
fail to store the correct value for MSSQL on an INSERT where the
primary key value was present in the insert params before execution.
fixes #3360
Mike Bayer [Sat, 4 Apr 2015 23:08:18 +0000 (19:08 -0400)]
- Fixed the pathing used when tests run; for sqla_nose.py and py.test,
the "./lib" prefix is again inserted at the head of sys.path but
only if sys.flags.no_user_site isn't set; this makes it act just
like the way Python puts "." in the current path by default.
For tox, we are setting the PYTHONNOUSERSITE flag now.
fixes #3356
Mike Bayer [Sat, 4 Apr 2015 16:02:51 +0000 (12:02 -0400)]
- Fixed a long-standing bug where the :class:`.Enum` type as used
with the psycopg2 dialect in conjunction with non-ascii values
and ``native_enum=False`` would fail to decode return results properly.
This stemmed from when the PG :class:`.postgresql.ENUM` type used
to be a standalone type without a "non native" option.
fixes #3354
- corrected the assertsql comparison rule to expect a non-ascii
SQL string
Mike Bayer [Thu, 2 Apr 2015 16:19:15 +0000 (12:19 -0400)]
- Fixed bug where the state tracking within multiple, nested
:meth:`.Session.begin_nested` operations would fail to propagate
the "dirty" flag for an object that had been updated within
the inner savepoint, such that if the enclosing savepoint were
rolled back, the object would not be part of the state that was
expired and therefore reverted to its database state.
fixes #3352
Mike Bayer [Wed, 1 Apr 2015 23:18:36 +0000 (19:18 -0400)]
- :class:`.Query` doesn't support joins, subselects, or special
FROM clauses when using the :meth:`.Query.update` or
:meth:`.Query.delete` methods; instead of silently ignoring these
fields if methods like :meth:`.Query.join` or
:meth:`.Query.select_from` has been called, an error is raised.
In 0.9.10 this only emits a warning.
fixes #3349
- don't needlessly call _compile_context() and build up a
whole statement that we never need. Construct QueryContext
as it's part of the event contract, but don't actually call upon
mapper attributes; use more direct systems of determining the
update or delete table.
- don't realy need _no_select_modifiers anymore
Mike Bayer [Wed, 1 Apr 2015 20:55:58 +0000 (16:55 -0400)]
- Added a list() call around a weak dictionary used within the
commit phase of the session, which without it could cause
a "dictionary changed size during iter" error if garbage collection
interacted within the process. Change was introduced by
Mike Bayer [Wed, 1 Apr 2015 20:50:32 +0000 (16:50 -0400)]
- Fixed bug where updated PG index reflection as a result of
:ticket:`3184` would cause index operations to fail on Postgresql
versions 8.4 and earlier. The enhancements are now
disabled when using an older version of Postgresql.
fixes #3343
Mike Bayer [Tue, 31 Mar 2015 18:40:21 +0000 (14:40 -0400)]
- The warning emitted by the unicode type for a non-unicode type
has been liberalized to warn for values that aren't even string
values, such as integers; previously, the updated warning system
of 1.0 made use of string formatting operations which
would raise an internal TypeError. While these cases should ideally
raise totally, some backends like SQLite and MySQL do accept them
and are potentially in use by legacy code, not to mention that they
will always pass through if unicode conversion is turned off
for the target backend.
fixes #3346
Mike Bayer [Mon, 30 Mar 2015 21:49:39 +0000 (17:49 -0400)]
- Fixed a bug related to "nested" inner join eager loading, which
exists in 0.9 as well but is more of a regression in 1.0 due to
:ticket:`3008` which turns on "nested" by default, such that
a joined eager load that travels across sibling paths from a common
ancestor using innerjoin=True will correctly splice each "innerjoin"
sibling into the appropriate part of the join, when a series of
inner/outer joins are mixed together.
fixes #3347
Mike Bayer [Tue, 24 Mar 2015 16:28:19 +0000 (12:28 -0400)]
- Turned off the "simple order by" flag on the MSSQL dialect; this
is the flag that per :ticket:`2992` causes an order by or group by
an expression that's also in the columns clause to be copied by
label, even if referenced as the expression object. The behavior
for MSSQL is now the old behavior that copies the whole expression
in by default, as MSSQL can be picky on these particularly in
GROUP BY expressions.
fixes #3338
- Add a test that includes a composed label in a GROUP BY
Mike Bayer [Tue, 24 Mar 2015 14:55:29 +0000 (10:55 -0400)]
- The "auto-attach" feature of constraints such as :class:`.UniqueConstraint`
and :class:`.CheckConstraint` has been further enhanced such that
when the constraint is associated with non-table-bound :class:`.Column`
objects, the constraint will set up event listeners with the
columns themselves such that the constraint auto attaches at the
same time the columns are associated with the table. This in particular
helps in some edge cases in declarative but is also of general use.
fixes #3341
Mike Bayer [Mon, 23 Mar 2015 16:33:48 +0000 (12:33 -0400)]
- Fixed bug in new "label resolution" feature of :ticket:`2992` where
a label that was anonymous, then labeled again with a name, would
fail to be locatable via a textual label. This situation occurs
naturally when a mapped :func:`.column_property` is given an
explicit label in a query.
fixes #3340
Mike Bayer [Sun, 22 Mar 2015 23:05:22 +0000 (19:05 -0400)]
- Fixed unicode support for PyMySQL when using an "executemany"
operation with unicode parameters. SQLAlchemy now passes both
the statement as well as the bound parameters as unicode
objects, as PyMySQL generally uses string interpolation
internally to produce the final statement, and in the case of
executemany does the "encode" step only on the final statement.
fixes #3337
Mike Bayer [Sat, 21 Mar 2015 17:12:15 +0000 (13:12 -0400)]
- Fixed bug in new "label resolution" feature of :ticket:`2992` where
the string label placed in the order_by() or group_by() of a statement
would place higher priority on the name as found
inside the FROM clause instead of a more locally available name
inside the columns clause.
fixes #3335
Mike Bayer [Fri, 20 Mar 2015 23:53:12 +0000 (19:53 -0400)]
- Repaired the commit for issue #2771 which was inadvertently commented
out.
- add __backend__ to the dialect suite so that it runs on CI.
- will be 1.0.0b3
Mike Bayer [Wed, 18 Mar 2015 22:57:13 +0000 (18:57 -0400)]
- Loosened some restrictions that were added to ``@declared_attr``
objects, such that they were prevented from being called outside
of the declarative process; this is related to the enhancements
of #3150 which allow ``@declared_attr`` to return a value that is
cached based on the current class as it's being configured.
The exception raise has been removed, and the behavior changed
so that outside of the declarative process, the function decorated by
``@declared_attr`` is called every time just like a regular
``@property``, without using any caching, as none is available
at this stage.
fixes #3331
Mike Bayer [Tue, 17 Mar 2015 16:32:33 +0000 (12:32 -0400)]
- The "auto close" for :class:`.ResultProxy` is now a "soft" close.
That is, after exhausing all rows using the fetch methods, the
DBAPI cursor is released as before and the object may be safely
discarded, but the fetch methods may continue to be called for which
they will return an end-of-result object (None for fetchone, empty list
for fetchmany and fetchall). Only if :meth:`.ResultProxy.close`
is called explicitly will these methods raise the "result is closed"
error.
fixes #3330 fixes #3329
Mike Bayer [Thu, 12 Mar 2015 14:14:52 +0000 (10:14 -0400)]
- try to document how to get columns from constraints.
unfortunately Sphinx refuses to work correctly for the columns
attribute so we just add a lame message to contains_column().
Mike Bayer [Thu, 12 Mar 2015 00:22:42 +0000 (20:22 -0400)]
- Added a new extension suite :mod:`sqlalchemy.ext.baked`. This
simple but unusual system allows for a dramatic savings in Python
overhead for the construction and processing of orm :class:`.Query`
objects, from query construction up through rendering of a string
SQL statement.
fixes #3054
Mike Bayer [Wed, 11 Mar 2015 18:46:52 +0000 (14:46 -0400)]
- Added a new entry ``"entity"`` to the dictionaries returned by
:attr:`.Query.column_descriptions`. This refers to the primary ORM
mapped class or aliased class that is referred to by the expression.
Compared to the existing entry for ``"type"``, it will always be
a mapped entity, even if extracted from a column expression, or
None if the given expression is a pure core expression.
references #3320