Mike Bayer [Wed, 1 Jul 2015 17:19:28 +0000 (13:19 -0400)]
- Fixed 1.0 regression where value objects that override
``__eq__()`` to return a non-boolean-capable object, such as
some geoalchemy types as well as numpy types, were being tested
for ``bool()`` during a unit of work update operation, where in
0.9 the return value of ``__eq__()`` was tested against "is True"
to guard against this.
fixes #3469
Mike Bayer [Mon, 29 Jun 2015 17:47:27 +0000 (13:47 -0400)]
- Fixed 1.0 regression where a "deferred" attribute would not populate
correctly if it were loaded within the "optimized inheritance load",
which is a special SELECT emitted in the case of joined table
inheritance used to populate expired or unloaded attributes against
a joined table without loading the base table. This is related to
the fact that SQLA 1.0 no longer guesses about loading deferred
columns and must be directed explicitly.
fixes #3468
Mike Bayer [Sat, 27 Jun 2015 04:40:34 +0000 (00:40 -0400)]
- Fixed 1.0 regression where the "parent entity" of a synonym-
mapped attribute on top of an :func:`.aliased` object would
resolve to the original mapper, not the :func:`.aliased`
version of it, thereby causing problems for a :class:`.Query`
that relies on this attribute (e.g. it's the only representative
attribute given in the constructor) to figure out the correct FROM
clause for the query.
fixes #3466
- apply consitency to ._parententity vs.
__clause_element__()._annotations['parententity']
in terms of aliased class, test it all.
Mike Bayer [Thu, 25 Jun 2015 01:53:15 +0000 (21:53 -0400)]
- Fixed a major regression in the 1.0 series where the version_id_counter
feature would cause an object's version counter to be incremented
when there was no net change to the object's row, but instead an object
related to it via relationship (e.g. typically many-to-one)
were associated or de-associated with it, resulting in an UPDATE
statement that updates the object's version counter and nothing else.
In the use case where the relatively recent "server side" and/or
"programmatic/conditional" version counter feature were used
(e.g. setting version_id_generator to False), the bug could cause an
UPDATE without a valid SET clause to be emitted.
fixes #3465
Mike Bayer [Mon, 22 Jun 2015 19:24:41 +0000 (15:24 -0400)]
- Fixed issue when using :class:`.VARBINARY` type in conjunction with
an INSERT of NULL + pyodbc; pyodbc requires a special
object be passed in order to persist NULL. As the :class:`.VARBINARY`
type is now usually the default for :class:`.LargeBinary` due to
:ticket:`3039`, this issue is partially a regression in 1.0.
The pymssql driver appears to be unaffected.
fixes #3464
Mike Bayer [Mon, 22 Jun 2015 15:35:02 +0000 (11:35 -0400)]
- Re-fixed this issue first released in 1.0.5 to fix psycopg2cffi
JSONB support once again, as they suddenly
switched on unconditional decoding of JSONB types in version 2.7.1.
Version detection now specifies 2.7.1 as where we should expect
the DBAPI to do json encoding for us.
fixes #3439
Mike Bayer [Fri, 19 Jun 2015 18:10:47 +0000 (14:10 -0400)]
- for #3455
- changelog
- versionadded + reflink for new pg storage parameters doc
- pep8ing
- add additional tests to definitely check that the Index object
is created all the way with the opts we want
fixes #3455
Mike Bayer [Fri, 19 Jun 2015 16:24:09 +0000 (12:24 -0400)]
- Fixed 1.0 regression where the enhanced behavior of single-inheritance
joins of :ticket:`3222` takes place inappropriately
for a JOIN along explicit join criteria with a single-inheritance
subclass that does not make use of any discriminator, resulting
in an additional "AND NULL" clause.
fixes #3462
Mike Bayer [Tue, 16 Jun 2015 18:33:53 +0000 (14:33 -0400)]
- Repaired the :class:`.ExcludeConstraint` construct to support common
features that other objects like :class:`.Index` now do, that
the column expression may be specified as an arbitrary SQL
expression such as :obj:`.cast` or :obj:`.text`.
fixes #3454
Mike Bayer [Sun, 14 Jun 2015 20:43:16 +0000 (16:43 -0400)]
- add test cases for pullreq github:182, where we add a new
"max_row_buffer" execution option for BufferedRowResultProxy
- also add documentation, changelog and version notes
- rework the max_row_buffer argument to be interpreted from
the execution options upfront when the BufferedRowResultProxy
is first initialized.
Mike Bayer [Sun, 14 Jun 2015 00:27:06 +0000 (20:27 -0400)]
- restore the approach we have for pk_params, but in order
to suit #3451 exclude these columns from the "params"
dictionary in the first place, revises pr github:181
Patrick Hayes [Sat, 13 Jun 2015 18:11:16 +0000 (14:11 -0400)]
Fix primary key behaviour in bulk_update
Suppose you have a model class with a primary key.
Base = declarative_base()
class User(Base):
id = Column(BigInteger, primary_key=True)
name = Column(String)
Previously, running
`bulk_update_mappings(User, {'id': 1, 'name': 'hello'})`
would emit the following:
```UPDATE users SET id=1, name='hello' WHERE id=1```
This is contrary to the stated behaviour, where primary keys are omitted
from the SET clause. Furthermore, this behaviour is harmful, as it
can cause the db engine to lock over-aggresively (at least in Postgres).
Mike Bayer [Thu, 11 Jun 2015 20:48:00 +0000 (16:48 -0400)]
- Fixed an unexpected-use regression whereby custom :class:`.Comparator`
objects that made use of the ``__clause_element__()`` method and
returned an object that was an ORM-mapped
:class:`.InstrumentedAttribute` and not explicitly a
:class:`.ColumnElement` would fail to be correctly
handled when passed as an expression to :meth:`.Session.query`.
The logic in 0.9 happened to succeed on this, so this use case is now
supported. fixes #3448
Mike Bayer [Wed, 10 Jun 2015 03:39:14 +0000 (23:39 -0400)]
- Fixed a bug where clause adaption as applied to a :class:`.Label`
object would fail to accommodate the labeled SQL expression
in all cases, such that any SQL operation that made use of
:meth:`.Label.self_group` would use the original unadapted
expression. One effect of this would be that an ORM :func:`.aliased`
construct would not fully accommodate attributes mapped by
:obj:`.column_property`, such that the un-aliased table could
leak out when the property were used in some kinds of SQL
comparisons.
fixes #3445
Mike Bayer [Mon, 8 Jun 2015 22:36:27 +0000 (18:36 -0400)]
- Fixed an internal "memoization" routine for method types such
that a Python descriptor is no longer used; repairs inspectability
of these methods including support for Sphinx documentation.
Mike Bayer [Sun, 7 Jun 2015 21:44:58 +0000 (17:44 -0400)]
- repair these tests to use the global manager_of_class fn,
as test_customfinder_pass at least does not provide the
alternate ext manager and in all cases it's the global function
that counts
Mike Bayer [Fri, 5 Jun 2015 21:34:02 +0000 (17:34 -0400)]
- Repaired some typing and test issues related to the pypy
psycopg2cffi dialect, in particular that the current 2.7.0 version
does not have native support for the JSONB type. The version detection
for psycopg2 features has been tuned into a specific sub-version
for psycopg2cffi. Additionally, test coverage has been enabled
for the full series of psycopg2 features under psycopg2cffi.
fixes #3439
Mike Bayer [Tue, 26 May 2015 14:56:23 +0000 (10:56 -0400)]
- Fixed bug where known boolean values used by
:func:`.engine_from_config` were not being parsed correctly;
these included ``pool_threadlocal`` and the psycopg2 argument
``use_native_unicode``. fixes #3435
- add legacy_schema_aliasing config parsing for mssql
- move use_native_unicode config arg to the psycopg2 dialect
Mike Bayer [Mon, 25 May 2015 01:02:29 +0000 (21:02 -0400)]
- Added a new dialect flag to the MSSQL dialect
``legacy_schema_aliasing`` which when set to False will disable a
very old and obsolete behavior, that of the compiler's
attempt to turn all schema-qualified table names into alias names,
to work around old and no longer locatable issues where SQL
server could not parse a multi-part identifier name in all
circumstances. The behavior prevented more
sophisticated statements from working correctly, including those which
use hints, as well as CRUD statements that embed correlated SELECT
statements. Rather than continue to repair the feature to work
with more complex statements, it's better to just disable it
as it should no longer be needed for any modern SQL server
version. The flag defaults to True for the 1.0.x series, leaving
current behavior unchanged for this version series. In the 1.1
series, it will default to False. For the 1.0 series,
when not set to either value explicitly, a warning is emitted
when a schema-qualified table is first used in a statement, which
suggests that the flag be set to False for all modern SQL Server
versions.
fixes #3424
fixes #3430
Mike Bayer [Fri, 22 May 2015 17:51:00 +0000 (13:51 -0400)]
- Adjustments to the engine plugin hook, such that the
:meth:`.URL.get_dialect` method will continue to return the
ultimate :class:`.Dialect` object when a dialect plugin is used,
without the need for the caller to be aware of the
:meth:`.Dialect.get_dialect_cls` method.
reference #3379
Mike Bayer [Thu, 21 May 2015 18:21:01 +0000 (14:21 -0400)]
- Fixed regression in the :mod:`sqlalchemy.ext.mutable` extension
as a result of the bugfix for :ticket:`3167`,
where attribute and validation events are no longer
called within the flush process. The mutable
extension was relying upon this behavior in the case where a column
level Python-side default were responsible for generating the new value
on INSERT or UPDATE, or when a value were fetched from the RETURNING
clause for "eager defaults" mode. The new value would not be subject
to any event when populated and the mutable extension could not
establish proper coercion or history listening. A new event
:meth:`.InstanceEvents.refresh_flush` is added which the mutable
extension now makes use of for this use case.
fixes #3427
- Added new event :meth:`.InstanceEvents.refresh_flush`, invoked
when an INSERT or UPDATE level default value fetched via RETURNING
or Python-side default is invoked within the flush process. This
is to provide a hook that is no longer present as a result of
:ticket:`3167`, where attribute and validation events are no longer
called within the flush process.
- Added a new semi-public method to :class:`.MutableBase`
:meth:`.MutableBase._get_listen_keys`. Overriding this method
is needed in the case where a :class:`.MutableBase` subclass needs
events to propagate for attribute keys other than the key to which
the mutable type is associated with, when intercepting the
:meth:`.InstanceEvents.refresh` or
:meth:`.InstanceEvents.refresh_flush` events. The current example of
this is composites using :class:`.MutableComposite`.
Mike Bayer [Fri, 15 May 2015 16:35:21 +0000 (12:35 -0400)]
- Added support for the case of the misbehaving DBAPI that has
pep-249 exception names linked to exception classes of an entirely
different name, preventing SQLAlchemy's own exception wrapping from
wrapping the error appropriately.
The SQLAlchemy dialect in use needs to implement a new
accessor :attr:`.DefaultDialect.dbapi_exception_translation_map`
to support this feature; this is implemented now for the py-postgresql
dialect.
fixes #3421
Mike Bayer [Thu, 14 May 2015 23:22:53 +0000 (19:22 -0400)]
- The "lightweight named tuple" used when a :class:`.Query` returns
rows failed to implement ``__slots__`` correctly such that it still
had a ``__dict__``. This is resolved, but in the extremely
unlikely case someone was assigning values to the returned tuples,
that will no longer work.
fixes #3420
Mike Bayer [Thu, 14 May 2015 17:59:04 +0000 (13:59 -0400)]
- Fixed bug where in the case that a pool checkout event handler is used
and the database can no longer be connected towards, that the checkout
handler failure is caught, the attempt to re-acquire the connection
also raises an exception, but the underlying connection record
is not immediately re-checked in before the exception is propagated
outwards, having the effect that the checked-out record does not close
itself until the stack trace it's associated with is garbage collected,
preventing that record from being used for a new checkout until we
leave the scope of the stack trace. This can lead to confusion
in the specific case of when the number of current stack traces
in memory exceeds the number of connections the pool can return,
as the pool will instead begin to raise errors about no more checkouts
available, rather than attempting a connection again. The fix
applies a checkin of the record before re-raising.
fixes #3419
Mike Bayer [Fri, 8 May 2015 16:37:55 +0000 (12:37 -0400)]
- Added official support for a CTE used by the SELECT present
inside of :meth:`.Insert.from_select`. This behavior worked
accidentally up until 0.9.9, when it no longer worked due to
unrelated changes as part of :ticket:`3248`. Note that this
is the rendering of the WITH clause after the INSERT, before the
SELECT; the full functionality of CTEs rendered at the top
level of INSERT, UPDATE, DELETE is a new feature targeted for a
later release.
fixes #3418
Mike Bayer [Wed, 6 May 2015 21:07:24 +0000 (17:07 -0400)]
- Fixed unexpected-use regression where in the odd case that the
primaryjoin of a relationship involved comparison to an unhashable
type such as an HSTORE, lazy loads would fail due to a hash-oriented
check on the statement parameters, modified in 1.0 as a result of
:ticket:`3061` to use hashing and modified in :ticket:`3368`
to occur in cases more common than "load on pending".
The values are now checked for the ``__hash__`` attribute beforehand.
fixes #3416
Peter Hoffmann [Tue, 5 May 2015 14:00:09 +0000 (16:00 +0200)]
Mark tests that they require OFFSET support in database
The sqlalchemy_exasol dialect needs to support Exasol 4.x which does not support
the OFFSET feature. Mark test with testing.requires.offset so that they can be skipped
of in the exasol specific test suite.
Mike Bayer [Sat, 2 May 2015 15:33:54 +0000 (11:33 -0400)]
- Liberalized an assertion that was added as part of :ticket:`3347`
to protect against unknown conditions when splicing inner joins
together within joined eager loads with ``innerjoin=True``; if
some of the joins use a "secondary" table, the assertion needs to
unwrap further joins in order to pass.
fixes #3412
Mike Bayer [Sat, 2 May 2015 14:27:03 +0000 (10:27 -0400)]
- Fixed bug in enhanced constraint-attachment logic introduced in
:ticket:`3341` where in the unusual case of a constraint that refers
to a mixture of :class:`.Column` objects and string column names
at the same time, the auto-attach-on-column-attach logic will be
skipped; for the constraint to be auto-attached in this case,
all columns must be assembled on the target table up front.
Added a new section to the migration document regarding the
original feature as well as this change.
fixes #3411
Mike Bayer [Sat, 2 May 2015 13:22:11 +0000 (09:22 -0400)]
- start qualifying some regressions as "unexpected use"
regressions; regressions where we didn't know an API even worked
in a particular way or that anyone were using it in such a way
hence had no tests for such case.
Mike Bayer [Fri, 1 May 2015 17:15:51 +0000 (13:15 -0400)]
- move away from explicit raises of SkipTest, instead call a
function patched onto config. nose/pytest backends now fill
in their exception class here only when loaded
- use more public seeming api to get at py.test Skipped
exception
Mike Bayer [Fri, 1 May 2015 16:06:34 +0000 (12:06 -0400)]
- Repair _reinstall_default_lookups to also flip the _extended flag
off again so that test fixtures setup/teardown instrumentation as
expected
- clean up test_extendedattr.py and fix it to no longer leak
itself outside by ensuring _reinstall_default_lookups is always called,
part of #3408
- Fixed bug where when using extended attribute instrumentation system,
the correct exception would not be raised when :func:`.class_mapper`
were called with an invalid input that also happened to not
be weak referencable, such as an integer.
fixes #3408