Mike Bayer [Wed, 27 Apr 2016 16:37:58 +0000 (11:37 -0500)]
Don't double-process ResultMetaData for BufferedColumnResultProxy
Fixed a bug in the result proxy used mainly by Oracle when binary and
other LOB types are in play, such that when query / statement caching
were used, the type-level result processors, notably that required by
the binary type itself but also any other processor, would become lost
after the first run of the statement due to it being removed from the
cached result metadata.
Mike Bayer [Wed, 27 Apr 2016 00:00:43 +0000 (19:00 -0500)]
Simplify directed graph example
Changed the "directed graph" example to no longer consider
integer identifiers of nodes as significant; the "higher" / "lower"
references now allow mutual edges in both directions.
Mike Bayer [Thu, 21 Apr 2016 14:36:19 +0000 (10:36 -0400)]
Fix result set handling for case insensitive dupe cols
Fixed bug where when using ``case_sensitive=False`` with an
:class:`.Engine`, the result set would fail to correctly accomodate
for duplicate column names in the result set, causing an error
when the statement is executed in 1.0, and preventing the
"ambiguous column" exception from functioning in 1.1.
Mike Bayer [Tue, 19 Apr 2016 20:11:23 +0000 (16:11 -0400)]
Deprecate Mapper.order_by
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.
Mike Bayer [Tue, 19 Apr 2016 19:46:37 +0000 (15:46 -0400)]
Rename Query._mapper_zero() to Query._entity_zero()
To be more descriptive of the use of _mapper_zero(), rename
it to _entity_zero(), but also supply a new _mapper_zero() function
that more strictly returns a mapper. The existing
_entity_zero() function is renamed to _query_entity_zero.
_only_mapper_zero() is removed as it isn't used. Divide up the
existing calling functions to refer to the appropriate new method.
Mike Bayer [Mon, 18 Apr 2016 20:18:31 +0000 (16:18 -0400)]
Propagate hybrid properties / info
Keystone and others depend on the .property attribute being
"mirrored" when a @hybrid_property is linked directly to a
mapped attribute. Restore this linkage and also create a defined
behavior for the .info dictionary; it is that of the hybrid itself.
Add this behavioral change to the migration notes.
Mike Bayer [Sun, 10 Apr 2016 18:56:01 +0000 (14:56 -0400)]
Honor hybrid property / method docstrings
The docstring specified on a hybrid property or method is now honored
at the class level, allowing it to work with tools like Sphinx
autodoc. The mechanics here necessarily involve some wrapping of
expressions to occur for hybrid properties, which may cause them
to appear differently using introspection.
Mike Bayer [Wed, 30 Mar 2016 21:27:53 +0000 (17:27 -0400)]
- make sure negative row indexes are based on the size of the
number of columns we're actually reporting on
- add more tests for negative row index
- changelog/migration
Mike Bayer [Tue, 29 Mar 2016 21:56:02 +0000 (17:56 -0400)]
- Added :meth:`.Select.lateral` and related constructs to allow
for the SQL standard LATERAL keyword, currently only supported
by Postgresql. fixes #2857
Mike Bayer [Wed, 23 Mar 2016 20:54:03 +0000 (16:54 -0400)]
- Further continuing on the common MySQL exception case of
a savepoint being cancelled first covered in :ticket:`2696`,
the failure mode in which the :class:`.Session` is placed when a
SAVEPOINT vanishes before rollback has been improved to allow the
:class:`.Session` to still function outside of that savepoint.
It is assumed that the savepoint operation failed and was cancelled.
fixes #3680
Mike Bayer [Mon, 21 Mar 2016 14:57:40 +0000 (10:57 -0400)]
- Fixed bug where the negation of an EXISTS expression would not
be properly typed as boolean in the result, and also would fail to be
anonymously aliased in a SELECT list as is the case with a
non-negated EXISTS construct.
fixes #3682
Mike Bayer [Tue, 15 Mar 2016 21:47:34 +0000 (17:47 -0400)]
- Added basic isolation level support to the SQL Server dialects
via :paramref:`.create_engine.isolation_level` and
:paramref:`.Connection.execution_options.isolation_level`
parameters. fixes #3534
Mike Bayer [Mon, 14 Mar 2016 21:56:57 +0000 (17:56 -0400)]
- 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
erronously cause the "New instance with identity X conflicts with
persistent instance Y" error.
fixes #3677
Mike Bayer [Thu, 3 Mar 2016 01:24:49 +0000 (20:24 -0500)]
- move out unconsumed names tests from test_compiler out to test_insert, test_update
- establish consistent names between existing unconsumed names tests and new ones
added per ref #3666
Mike Bayer [Fri, 26 Feb 2016 16:27:12 +0000 (11:27 -0500)]
- unfortunately calling upon "_label" here makes it unclear if
we're trying to hit columns without names yet and such, to suit the bug
right now just make it specific to FunctionElement
Mike Bayer [Fri, 26 Feb 2016 05:20:39 +0000 (00:20 -0500)]
- Anonymous labeling is applied to a :attr:`.func` construct that is
passed to :func:`.column_property`, so that if the same attribute
is referred to as a column expression twice the names are de-duped,
thus avoiding "ambiguous column" errors. Previously, the
``.label(None)`` would need to be applied in order for the name
to be de-anonymized.
fixes #3663
Mike Bayer [Fri, 26 Feb 2016 04:22:30 +0000 (23:22 -0500)]
- An improvement to the workings of :meth:`.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.
fixes #3662
Mike Bayer [Mon, 22 Feb 2016 03:46:31 +0000 (22:46 -0500)]
- additional adjustment to the fix made in 8ad968f33100baeb3b13c7e0b724b6b79ab4277f
for ref #3657. The Oracle dialect makes more use of the "select_wraps_for"
feature than SQL server because Oracle doesn't have "TOP" for a limit-only
select, so tests are showing more happening here. In the case where
the select() has some dupe columns, these are deduped from the .c collection
so a positional match between the wrapper and original can't use .inner_columns,
because these collections wont match. Using _columns_plus_names
instead which is the deduped collection that determines the SELECT display,
which definitely have to match up.
Mike Bayer [Mon, 22 Feb 2016 01:52:43 +0000 (20:52 -0500)]
- Fixed bug in "to_list" conversion where a single bytes object
would be turned into a list of individual characters. This would
impact among other things using the :meth:`.Query.get` method
on a primary key that's a bytes object.
fixes #3660
Mike Bayer [Sun, 21 Feb 2016 01:22:38 +0000 (20:22 -0500)]
- reworked the way the "select_wraps_for" expression is
handled within visit_select(); this attribute was added in the
1.0 series to accommodate the subquery wrapping behavior of
SQL Server and Oracle while also working with positional
column targeting and no longer relying upon "key fallback"
in order to target columns in such a statement. The IBM DB2
third-party dialect also has this use case, but its implementation
is using regular expressions to rewrite the textual SELECT only
and does not make use of a "wrapped" select at this time.
The logic no longer attempts to reconcile proxy set collections as
this was not deterministic, and instead assumes that the select()
and the wrapper select() match their columns postionally,
at least for the column positions they have in common,
so it is now very simple and safe. fixes #3657.
- as a side effect of #3657 it was also revealed that the
strategy of calling upon a ResultProxy._getter was not
correctly calling into NoSuchColumnError when an expected
column was not present, and instead returned None up to
loading.instances() to produce NoneType failures; added
a raiseerr argument to _getter() which is called when we
aren't expecting None, fixes #3658.
Mike Bayer [Wed, 17 Feb 2016 22:54:43 +0000 (17:54 -0500)]
- 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. fixes #3431
Mike Bayer [Wed, 17 Feb 2016 21:53:01 +0000 (16:53 -0500)]
- handle parameter sets that aren't correctly formed, so that
for example an exception object made within a test suite can
still repr (error seen in Keystone)
Mike Bayer [Wed, 17 Feb 2016 18:31:29 +0000 (13:31 -0500)]
- All string formatting of bound parameter sets and result rows for
logging, exception, and ``repr()`` purposes now truncate very large
scalar values within each collection, including an
"N characters truncated"
notation, similar to how the display for large multiple-parameter sets
are themselves truncated.
fixes #2837
Mike Bayer [Fri, 12 Feb 2016 03:29:18 +0000 (22:29 -0500)]
- Fixed bug in :meth:`.Session.merge` where an object with a composite
primary key that has values for some but not all of the PK fields
would emit a SELECT statement leaking the internal NEVER_SET symbol
into the query, rather than detecting that this object does not have
a searchable primary key and no SELECT should be emitted.
fixes #3647
Mike Bayer [Thu, 11 Feb 2016 17:12:19 +0000 (12:12 -0500)]
- CTE functionality has been expanded to support all DML, allowing
INSERT, UPDATE, and DELETE statements to both specify their own
WITH clause, as well as for these statements themselves to be
CTE expressions when they include a RETURNING clause.
fixes #2551
Mike Bayer [Wed, 10 Feb 2016 15:17:45 +0000 (10:17 -0500)]
- add more documentation to MutableDict explaining
that this structure is only intended to track additions
and removals from the dictionary, not recursive tracking
of embedded changes. fixes #3646.
Mike Bayer [Wed, 10 Feb 2016 02:08:21 +0000 (21:08 -0500)]
- don't drop the ts1/ts2 databases without seeing the primary DB,
because we never log in on the ts1/ts2. races against other runs
and erases their DBs
Mike Bayer [Tue, 9 Feb 2016 23:05:40 +0000 (18:05 -0500)]
- Fixed bug in :func:`.expression.text` construct where a double-colon
expression would not escape properly, e.g. ``some\:\:expr``, as is most
commonly required when rendering Postgresql-style CAST expressions.
fixes #3644
Mike Bayer [Tue, 9 Feb 2016 22:49:38 +0000 (17:49 -0500)]
- A refinement to the logic which adds columns to the resulting SQL when
:meth:`.Query.distinct` is combined with :meth:`.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.
fixes #3641
Mike Bayer [Tue, 9 Feb 2016 03:57:02 +0000 (22:57 -0500)]
- Testing reveals that we have *no* weak references to any cx_Oracle connections at all,
yet cx_Oracle still has open sessions that cannot be killed until process dies.
Oracle wins! Add a completely separate DB reaper script that runs
after py.test is done.
Mike Bayer [Mon, 8 Feb 2016 23:05:51 +0000 (18:05 -0500)]
- fully hyperlink the docstring for make_transient
- establish make_transient and make_transient_to_detached as special-use,
advanced use only functions
- list all conditions under make_transient() under which an attribute
will not be loaded and establish that make_transient() does not attempt
to load all attributes before detaching the object from its
session, fixes #3640
Mike Bayer [Mon, 8 Feb 2016 18:13:39 +0000 (13:13 -0500)]
- adjust to allow dblink tests to work with multiprocess users.
unfortunately the synonym doesn't work for SQL statements here
when the dblink is on a different user, testing this is not really
critical so just removed it.
Mike Bayer [Thu, 4 Feb 2016 18:36:45 +0000 (13:36 -0500)]
- add an impl for Enum to Oracle which has subclassing requirements
on unicode. Enum would be better as a TypeDecorator
at this point but then that becomes awkward with native enum
types (Interval works that way, but we don't need the bind_processor for
native interval...)