The ON DELETE options for foreign keys are now part of
Oracle reflection. Oracle does not support ON UPDATE
cascades. Pull request courtesy Miroslav Shubernetskiy.
Daniel Knell [Mon, 5 Feb 2018 14:25:47 +0000 (09:25 -0500)]
fix handling of native enum aliases in sqlalchemy enum columns
Fixed bug where the :class:`.Enum` type wouldn't handle
enum "aliases" correctly, when more than one key refers to the
same value. Pull request courtesy Daniel Knell.
Mike Bayer [Mon, 5 Feb 2018 14:03:08 +0000 (09:03 -0500)]
Convert dialect modules to relative imports and test
For some reason the dialects were not consistently
converted to relative imports. Also added a test to
ensure that __all__ is functioning within each dialect.
Mike Bayer [Fri, 2 Feb 2018 14:36:25 +0000 (09:36 -0500)]
Look for __sa_reconstructor__ on original_init
Fixed bug where the :func:`.orm.reconstructor` event
helper would not be recognized if it were applied to the
``__init__()`` method of the mapped class.
It's not clear when this bug appeared, but was likely
during a refactoring of instrumentation mechanics somewhere
between 0.8 and 1.0.
Mike Bayer [Tue, 30 Jan 2018 20:51:30 +0000 (15:51 -0500)]
Disable set eq test for python < 2.7.8
A test added in 1.2 thought to confirm a Python 2.7 behavior turns out to
be confirming the behavior only as of Python 2.7.8. Python bug #8743 still
impacts set comparison in Python 2.7.7 and earlier, so the test in question
involving AssociationSet no longer runs for these older Python 2.7
versions.
Mike Bayer [Mon, 29 Jan 2018 23:07:19 +0000 (18:07 -0500)]
Ensure _BundleEntity provides .mapper
Fixed bug where the :class:`.Bundle` object did not
correctly report upon the primary :class:`.Mapper` object
represened by the bundle, if any. An immediate
side effect of this issue was that the new selectinload
loader strategy wouldn't work with the horizontal sharding
extension.
robin [Sat, 27 Jan 2018 18:02:30 +0000 (13:02 -0500)]
Raise the sqlite3 import error, not the pysqlite2 one
Fixed the import error raised when a platform
has neither pysqlite2 nor sqlite3 installed, such
that the sqlite3-related import error is raised,
not the pysqlite2 one which is not the actual
failure mode. Pull request courtesy Robin.
Origin version only print `No module named pysqlite2` even
it's actually the import error of line 337: `from
sqlite3 import dbapi2 as sqlite` which point user
to the wrong debug direction.
It should raise `e.message` as `No module named _sqlite3`.
Mike Bayer [Thu, 25 Jan 2018 21:11:29 +0000 (16:11 -0500)]
Add a new FAQ section explaining how to ensure parenthesis
with op().
Not sure if this can be further improved at some point, such
as if a BinaryExpression automatically applied self_group()
when op() is called, however for the moment op() behaves consistently
as with all other operators without any ad-hoc effects.
Mike Bayer [Wed, 24 Jan 2018 16:09:47 +0000 (11:09 -0500)]
Ensure backrefs accommodate for op_bulk_replace
Fixed 1.2 regression regarding new bulk_replace event
where a backref would fail to remove an object from the
previous owner when a bulk-assignment assigned the
object to a new owner.
As this revisits the Event tokens associated with
AttributeImpl objects, remove the verbosity of the
"inline lazy init" pattern; the Event token is a simple
slotted object and should have minimal memory overhead.
Mike Bayer [Wed, 24 Jan 2018 22:27:10 +0000 (17:27 -0500)]
Adjust tests for pyodbc 4.0.22
pyodbc 4.0.22 is no longer allowing a datetime to be truncated
into a date, and additionally is asserting that numeric truncation
is not occurring; previously, it looks like we could send a
decimal of -1E-25 through the driver but we were only getting
back -1E-20, the test failed to check this. Not clear if the
larger precision worked fully at some point, but in any case,
it doesn't work now so just remove those values from the test.
Mike Bayer [Wed, 24 Jan 2018 23:03:04 +0000 (18:03 -0500)]
Rework synonym, synonym_for documentation
The map_column example was incorrect, and overall the purpose
of this parameter as well as that of synonym_for was not explained;
examples added along with more encouragement to use hybrids.
This is the only way I could get this test pass on informix, basically I strip every whitespace.
The sql text as recorded in informix is:
```
((a > 1 ) AND (a < 5 ) )
((a = 1 ) OR ((a > 2 ) AND (a <5 ) ) )
```
Yes, this is absolutely bonkers, but that is what I get :(
Mike Bayer [Tue, 16 Jan 2018 17:41:29 +0000 (12:41 -0500)]
Use NCHAR + setinputsizes() for all NVARCHAR2
The cx_Oracle dialect now calls setinputsizes() with cx_Oracle.NCHAR
unconditionally when the NVARCHAR2 datatype, in SQLAlchemy corresponding
to sqltypes.Unicode(), is in use. Per cx_Oracle's author this allows
the correct conversions to occur within the Oracle client regardless
of the setting for NLS_NCHAR_CHARACTERSET.
Mike Bayer [Wed, 10 Jan 2018 03:17:59 +0000 (22:17 -0500)]
Make column-level collation quoting dialect-specific
Fixed regression in 1.2 where newly repaired quoting
of collation names in :ticket:`3785` breaks SQL Server,
which explicitly does not understand a quoted collation
name. Whether or not mixed-case collation names are
quoted or not is now deferred down to a dialect-level
decision so that each dialect can prepare these identifiers
directly.
Mike Bayer [Wed, 10 Jan 2018 04:03:40 +0000 (23:03 -0500)]
Limit select in loading for correct types
Fixed bug in new "selectin" relationship loader where the loader could try
to load a non-existent relationship when loading a collection of
polymorphic objects, where only some of the mappers include that
relationship, typically when :meth:`.PropComparator.of_type` is being used.
This generalizes the mapper limiting that was present
in _load_subclass_via_in() to be part of the PostLoad object
itself, and is used by both polymorphic selectin loading and
relationship selectin loading.
Fixed bug in :meth:`.Insert.values` where using the "multi-values"
format in combination with :class:`.Column` objects as keys rather
than strings would fail. Pull request courtesy Aubrey Stark-Toller.
Mike Bayer [Fri, 5 Jan 2018 20:42:34 +0000 (15:42 -0500)]
Turn on testing for JSON under Mariadb 10.2.7 and greater
MariaDB adds a JSON alias for the LONGTEXT datatype and
all the same json functions work against it in any case.
What doesn't work is reflection, since it's just an alias,
and also the CAST we were using in one of our tests doesn't seem
to work for JSON which is probably also because it's not
a real datatype.
Mike Bayer [Wed, 10 Jan 2018 20:27:33 +0000 (15:27 -0500)]
Set up of_type variable for legacy loader option deserialize
Fixed regression where pickle format of a Load / _UnboundLoad object (e.g.
loader options) changed and ``__setstate__()`` was raising an
UnboundLocalError for an object received from the legacy format, even
though an attempt was made to do so. tests are now added to ensure this
works.
Mike Bayer [Wed, 10 Jan 2018 04:35:23 +0000 (23:35 -0500)]
Disable the singletonthreadpool test cleanup no gc
This test often fails on CI under load and reveals a small
race condition within SingleonThreadPool's "cleanup" system.
As this pool's "cleanup" system is pretty much never used in
any case since this pool is no longer used for SQLite file
databases, this race should have little impact, especially
since the occasional non-closed connection will get closed
out when it's GC'ed in any case.
Mike Bayer [Mon, 8 Jan 2018 21:05:23 +0000 (16:05 -0500)]
Re-enable setinputsizes for Oracle TIMESTAMP
Fixed regression where the removal of most setinputsizes
rules from cx_Oracle dialect impacted the TIMESTAMP
datatype's ability to retrieve fractional seconds.
Mike Bayer [Thu, 4 Jan 2018 21:58:55 +0000 (16:58 -0500)]
Don't try to iterate chopped path if it's None
Fixed regression caused by new lazyload caching scheme in :ticket:`3954`
where a query that makes use of loader options with of_type would cause
lazy loads of unrelated paths to fail with a TypeError.
Mike Bayer [Thu, 4 Jan 2018 19:09:32 +0000 (14:09 -0500)]
Check for object was expunged before restoring after pk switch + rollback
Fixed bug where an object that is expunged during a rollback of
a nested or subtransaction which also had its primary key mutated
would not be correctly removed from the session, causing subsequent
issues in using the session.
Mike Bayer [Thu, 4 Jan 2018 15:44:53 +0000 (10:44 -0500)]
Add rule to prevent "GROUP BY <expr>" in tests
Added a new exclusion rule group_by_complex_expression
which disables tests that use "GROUP BY <expr>", which seems
to be not viable for at least two third party dialects.
Mike Bayer [Tue, 2 Jan 2018 22:56:45 +0000 (17:56 -0500)]
Check for the endmost target when chaining contains()
Fixed regression in association proxy due to :ticket:`3769`
(allow for chained any() / has()) where contains() against
an association proxy chained in the form
(o2m relationship, associationproxy(m2o relationship, m2o relationship))
would raise an error regarding the re-application of contains()
on the final link of the chain.
Mike Bayer [Thu, 14 Dec 2017 15:20:50 +0000 (10:20 -0500)]
Add an identity_token to the identity key
For the purposes of assisting with sharded setups, add a new
member to the identity key that can be customized. this allows
sharding across databases where the primary key space is shared.
Mike Bayer [Fri, 15 Dec 2017 15:56:18 +0000 (10:56 -0500)]
Open up all cx_Oracle numeric tests, finish infinity support
Added some additional rules to fully handle ``Decimal('Infinity')``,
``Decimal('-Infinity')`` values with cx_Oracle numerics when using
``asdecimal=True``.
Allow remaining cx_Oracle numeric tests that were waiting
for the refactor to be finished and forgot to get enabled.
Mike Bayer [Thu, 14 Dec 2017 18:58:58 +0000 (13:58 -0500)]
Fully copy index expressions
Fixed bug where the :meth:`.Table.tometadata` method would not properly
accommodate :class:`.Index` objects that didn't consist of simple
column expressions, such as indexes against a :func:`.text` construct,
indexes that used SQL expressions or :attr:`.func`, etc. The routine
now copies expressions fully to a new :class:`.Index` object while
substituting all table-bound :class:`.Column` objects for those
of the target table.
Also refined the means by which tometadata() checks if an Index
or UniqueConstraint is generated by a column-level flag, by propagating
an attribute "_column_flag=True" to such indexes/constraints.
Mike Bayer [Wed, 6 Dec 2017 21:22:31 +0000 (16:22 -0500)]
Disable eager loads for exists()
The :meth:`.Query.exists` method will now disable eager loaders for when
the query is rendered. Previously, joined-eager load joins would be rendered
unnecessarily as well as subquery eager load queries would be needlessly
generated. The new behavior matches that of the :meth:`.Query.subquery`
method.
Mike Bayer [Wed, 6 Dec 2017 19:12:42 +0000 (14:12 -0500)]
Change visit name for ColumnElement
No SQLA built-in subclasses ColumnElement without specifying
an alternate visit_name, and user defined ColumnElement
subclasses should avoid being treated like ColumnClause,
e.g. where a Table is present.
inytar [Mon, 30 Oct 2017 16:01:49 +0000 (12:01 -0400)]
Allow delete where clause to refer multiple tables.
Implemented "DELETE..FROM" syntax for Postgresql, MySQL, MS SQL Server
(as well as within the unsupported Sybase dialect) in a manner similar
to how "UPDATE..FROM" works. A DELETE statement that refers to more than
one table will switch into "multi-table" mode and render the appropriate
"USING" or multi-table "FROM" clause as understood by the database.
Pull request courtesy Pieter Mulder.
Mike Bayer [Mon, 4 Dec 2017 22:51:21 +0000 (17:51 -0500)]
Add missing changelog note for #4109
No changelog note was written at all for #4109 despite
this feature being released as of 1.2.0b3 (based on merge
date of 10/10/2017 and 1.2.0b3 release date of 10/13/2017
Mike Bayer [Fri, 3 Nov 2017 15:11:48 +0000 (11:11 -0400)]
Intercept contains_eager() with of_type, set aliased / polymorphic
Fixed bug in :func:`.contains_eager` query option where making use of a
path that used :meth:`.PropComparator.of_type` to refer to a subclass
across more than one level of joins would also require that the "alias"
argument were provided with the same subtype in order to avoid adding
unwanted FROM clauses to the query; additionally, using
:func:`.contains_eager` across subclasses that use :func:`.aliased` objects
of subclasses as the :meth:`.PropComparator.of_type` argument will also
render correctly.
Mike Bayer [Mon, 4 Dec 2017 21:40:20 +0000 (16:40 -0500)]
Propagate attachment events for ARRAY
Fixed regression in :class:`.ARRAY` datatype caused by
:ticket:`3964`, which is essentially the same
issue as that of :ticket:`3832`, where column attachment events
for :class:`.ARRAY` would not be invoked. This breaks the use case
of using declarative mixins that declare a :class:`.Column` which
makes use of :meth:`.MutableList.as_mutable`.
Mike Bayer [Mon, 4 Dec 2017 16:56:14 +0000 (11:56 -0500)]
Allow url.password to be an object
The "password" attribute of the :class:`.url.URL` object can now be
any user-defined or user-subclassed string object that responds to the
Python ``str()`` builtin. The object passed will be maintained as the
datamember :attr:`.url.URL.password_original` and will be consulted
when the :attr:`.url.URL.password` attribute is read to produce the
string value.
Mike Bayer [Fri, 1 Dec 2017 18:22:23 +0000 (13:22 -0500)]
Fix regexp for expanding IN
Fixed bug in new "expanding bind parameter" feature whereby if multiple
params were used in one statement, the regular expression would not
match the parameter name correctly.
Mike Bayer [Mon, 13 Nov 2017 14:21:48 +0000 (09:21 -0500)]
Propagate kwargs for mysql concat, match
Fixed bug where the MySQL "concat" and "match" operators failed to
propagate kwargs to the left and right expressions, causing compiler
options such as "literal_binds" to fail.
Also adds non-interpreted **kw for visit_create_index, visit_typeclause
Mike Bayer [Sun, 12 Nov 2017 23:44:41 +0000 (18:44 -0500)]
Add baked.Result.with_post_criteria method
Added new method :meth:`.baked.Result.with_post_criteria` to baked
query system, allowing non-SQL-modifying transformations to take place
after the query has been pulled from the cache. Among other things,
this method can be used with :class:`.horizontal_shard.ShardedQuery`
to set the shard identifier. :class:`.horizontal_shard.ShardedQuery`
has also been modified such that its :meth:`.ShardedQuery.get` method
interacts correctly with that of :class:`.baked.Result`.