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 [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
Kai Groner [Mon, 26 Jan 2015 19:49:40 +0000 (14:49 -0500)]
Partial index support with sqlite dialects.
From https://www.sqlite.org/partialindex.html
> Partial indexes have been supported in SQLite since version 3.8.0.
Reflection does not expose the predicate of partial indexes. The
postgresql dialect does detect such indexes and issue a warning. I
looked into matching this level of support, but the sqlite pragma
index_info does not expose the predicate. Getting this data would
probably require parsing the CREATE INDEX statement from sqlite_master.
Mike Bayer [Fri, 20 Feb 2015 20:14:08 +0000 (15:14 -0500)]
- Fixed bugs in ORM object comparisons where comparison of
many-to-one ``!= None`` would fail if the source were an aliased
class, or if the query needed to apply special aliasing to the
expression due to aliased joins or polymorphic querying; also fixed
bug in the case where comparing a many-to-one to an object state
would fail if the query needed to apply special aliasing
due to aliased joins or polymorphic querying.
fixes #3310
Mike Bayer [Fri, 20 Feb 2015 05:01:19 +0000 (00:01 -0500)]
- Fixed bug where internal assertion would fail in the case where
an ``after_rollback()`` handler for a :class:`.Session` incorrectly
adds state to that :class:`.Session` within the handler, and the task
to warn and remove this state (established by :ticket:`2389`) attempts
to proceed.
fixes #3309
Mike Bayer [Wed, 4 Feb 2015 23:51:24 +0000 (18:51 -0500)]
- Fixed bug in :class:`.Connection` and pool where the
:meth:`.Connection.invalidate` method, or an invalidation due
to a database disconnect, would fail if the
``isolation_level`` parameter had been used with
:meth:`.Connection.execution_options`; the "finalizer" that resets
the isolation level would be called on the no longer opened connection.
fixes #3302
Mike Bayer [Wed, 4 Feb 2015 22:07:15 +0000 (17:07 -0500)]
- A warning is emitted if the ``isolation_level`` parameter is used
with :meth:`.Connection.execution_options` when a :class:`.Transaction`
is in play; DBAPIs and/or SQLAlchemy dialects such as psycopg2,
MySQLdb may implicitly rollback or commit the transaction, or
not change the setting til next transaction, so this is never safe.
- Added new parameter :paramref:`.Session.connection.execution_options`
which may be used to set up execution options on a :class:`.Connection`
when it is first checked out, before the transaction has begun.
This is used to set up options such as isolation level on the
connection before the transaction starts.
- added new documentation section
detailing best practices for setting transaction isolation with
sessions.
fixes #3296
Mike Bayer [Tue, 3 Feb 2015 00:46:13 +0000 (19:46 -0500)]
- Fixed bug in lazy loading SQL construction whereby a complex
primaryjoin that referred to the same "local" column multiple
times in the "column that points to itself" style of self-referential
join would not be substituted in all cases. The logic to determine
substitutions here has been reworked to be more open-ended.
fixes #3300
Mike Bayer [Mon, 2 Feb 2015 00:00:07 +0000 (19:00 -0500)]
- Repaired support for Postgresql UUID types in conjunction with
the ARRAY type when using psycopg2. The psycopg2 dialect now
employs use of the psycopg2.extras.register_uuid() hook
so that UUID values are always passed to/from the DBAPI as
UUID() objects. The :paramref:`.UUID.as_uuid` flag is still
honored, except with psycopg2 we need to convert returned
UUID objects back into strings when this is disabled.
fixes #2940
Mike Bayer [Sun, 1 Feb 2015 00:04:54 +0000 (19:04 -0500)]
- Added support for the :class:`postgresql.JSONB` datatype when
using psycopg2 2.5.4 or greater, which features native conversion
of JSONB data so that SQLAlchemy's converters must be disabled;
additionally, the newly added psycopg2 extension
``extras.register_default_jsonb`` is used to establish a JSON
deserializer passed to the dialect via the ``json_deserializer``
argument. Also repaired the Postgresql integration tests which
weren't actually round-tripping the JSONB type as opposed to the
JSON type. Pull request courtesy Mateusz Susik.
- Repaired the use of the "array_oid" flag when registering the
HSTORE type with older psycopg2 versions < 2.4.3, which does not
support this flag, as well as use of the native json serializer
hook "register_default_json" with user-defined ``json_deserializer``
on psycopg2 versions < 2.5, which does not include native json.
Mike Bayer [Wed, 28 Jan 2015 16:48:20 +0000 (11:48 -0500)]
- Fixed bug in 0.9's foreign key setup system, such that
the logic used to link a :class:`.ForeignKey` to its parent could fail
when the foreign key used "link_to_name=True" in conjunction with
a target :class:`.Table` that would not receive its parent column until
later, such as within a reflection + "useexisting" scenario,
if the target column in fact had a key value different from its name,
as would occur in reflection if column reflect events were used to
alter the .key of reflected :class:`.Column` objects so that the
link_to_name becomes significant. Also repaired support for column
type via FK transmission in a similar way when target columns had a
different key and were referenced using link_to_name.
fixes #3298
Mike Bayer [Tue, 20 Jan 2015 16:37:13 +0000 (11:37 -0500)]
- Added new user-space accessors for viewing transaction isolation
levels; :meth:`.Connection.get_isolation_level`,
:attr:`.Connection.default_isolation_level`.
- enhance documentation inter-linkage between new accessors,
existing isolation_level parameters, as well as in
the dialect-level methods which should be fully covered
by Engine/Connection level APIs now.
Mike Bayer [Fri, 16 Jan 2015 23:03:45 +0000 (18:03 -0500)]
- Fixed bug where Postgresql dialect would fail to render an
expression in an :class:`.Index` that did not correspond directly
to a table-bound column; typically when a :func:`.text` construct
was one of the expressions within the index; or could misinterpret the
list of expressions if one or more of them were such an expression.
fixes #3174
Mike Bayer [Tue, 13 Jan 2015 22:04:35 +0000 (17:04 -0500)]
- The "wildcard" loader options, in particular the one set up by
the :func:`.orm.load_only` option to cover all attributes not
explicitly mentioned, now takes into account the superclasses
of a given entity, if that entity is mapped with inheritance mapping,
so that attribute names within the superclasses are also omitted
from the load. Additionally, the polymorphic discriminator column
is unconditionally included in the list, just in the same way that
primary key columns are, so that even with load_only() set up,
polymorphic loading of subtypes continues to function correctly.
fixes #3287
Mike Bayer [Tue, 6 Jan 2015 02:38:19 +0000 (21:38 -0500)]
- Fixed bug where if an exception were thrown at the start of a
:class:`.Query` before it fetched results, particularly when
row processors can't be formed, the cursor would stay open with
results pending and not actually be closed. This is typically only
an issue on an interpreter like Pypy where the cursor isn't
immediately GC'ed, and can in some circumstances lead to transactions/
locks being open longer than is desirable.
fixes #3285
Mike Bayer [Tue, 30 Dec 2014 01:01:21 +0000 (20:01 -0500)]
- fix some RST whitespace syntactical issues in toctrees
- have the topmost toctree only include page names
- add glossary to toctree, remove search by itself
Mike Bayer [Wed, 17 Dec 2014 22:24:23 +0000 (17:24 -0500)]
- squash-merge the improve_toc branch, which moves all the Sphinx styling
and extensions into an external library, and also reorganizes most large documentation
pages into many small areas to reduce scrolling and better present the context
into a more fine-grained hierarchy.
Mike Bayer [Fri, 19 Dec 2014 17:14:52 +0000 (12:14 -0500)]
- Fixed bug where using a :class:`.TypeDecorator` that implemented
a type that was also a :class:`.TypeDecorator` would fail with
Python's "Cannot create a consistent method resolution order (MRO)"
error, when any kind of SQL comparison expression were used against
an object using this type.
Mike Bayer [Sat, 13 Dec 2014 00:59:11 +0000 (19:59 -0500)]
- Added new method :meth:`.Session.invalidate`, functions similarly
to :meth:`.Session.close`, except also calls
:meth:`.Connection.invalidate`
on all connections, guaranteeing that they will not be returned to
the connection pool. This is useful in situations e.g. dealing
with gevent timeouts when it is not safe to use the connection further,
even for rollbacks.
references #3258
Mike Bayer [Wed, 26 Nov 2014 19:58:44 +0000 (14:58 -0500)]
- Updated the :ref:`examples_versioned_history` example such that
mapped columns are re-mapped to
match column names as well as grouping of columns; in particular,
this allows columns that are explicitly grouped in a same-column-named
joined inheritance scenario to be mapped in the same way in the
history mappings, avoiding warnings added in the 0.9 series
regarding this pattern and allowing the same view of attribute
keys.
Mike Bayer [Mon, 24 Nov 2014 17:33:56 +0000 (12:33 -0500)]
- Fixed a bug in the examples/generic_assocaitions/discriminator_on_association.py
example, where the subclasses of AddressAssociation were not being
mapped as "single table inheritance", leading to problems when trying
to use the mappings further.
Mike Bayer [Thu, 13 Nov 2014 18:17:38 +0000 (13:17 -0500)]
- Fixed a leak which would occur in the unsupported and highly
non-recommended use case of replacing a relationship on a fixed
mapped class many times, referring to an arbitrarily growing number of
target mappers. A warning is emitted when the old relationship is
replaced, however if the mapping were already used for querying, the
old relationship would still be referenced within some registries.
fixes #3251
Mike Bayer [Tue, 11 Nov 2014 17:34:00 +0000 (12:34 -0500)]
- Fixed issue where the columns from a SELECT embedded in an
INSERT, either through the values clause or as a "from select",
would pollute the column types used in the result set produced by
the RETURNING clause when columns from both statements shared the
same name, leading to potential errors or mis-adaptation when
retrieving the returning rows.
fixes #3248
Mike Bayer [Mon, 10 Nov 2014 22:58:09 +0000 (17:58 -0500)]
- in lieu of adding a new system of translating bound parameter names
for psycopg2 and others, encourage users to take advantage of positional
styles by documenting "paramstyle". A section is added to psycopg2
specifically as this is a pretty common spot for named parameters
that may be unusually named. fixes #3246.
Mike Bayer [Wed, 5 Nov 2014 09:22:30 +0000 (04:22 -0500)]
- Fixed bug regarding expression mutations which could express
itself as a "Could not locate column" error when using
:class:`.Query` to select from multiple, anonymous column
entities when querying against SQLite, as a side effect of the
"join rewriting" feature used by the SQLite dialect.
fixes #3241
Mike Bayer [Thu, 23 Oct 2014 04:40:29 +0000 (00:40 -0400)]
- Fixed bug where the ON clause for :meth:`.Query.join`,
and :meth:`.Query.outerjoin` to a single-inheritance subclass
using ``of_type()`` would not render the "single table criteria" in
the ON clause if the ``from_joinpoint=True`` flag were set.
fixes #3232
Mike Bayer [Sun, 19 Oct 2014 20:56:18 +0000 (16:56 -0400)]
- repair documenation for object_session(), returns None if no
session, and refer to InstanceState.session. Add note about
objects that are deleted within an ongoing transaction.
Mike Bayer [Mon, 13 Oct 2014 00:14:32 +0000 (20:14 -0400)]
- Mysqlconnector as of version 2.0, probably as a side effect of
the python 3 merge, now does not expect percent signs (e.g.
as used as the modulus operator and others) to be doubled,
even when using the "pyformat" bound parameter format (this
change is not documented by Mysqlconnector). The dialect now
checks for py2k and for mysqlconnector less than version 2.0
when detecting if the modulus operator should be rendered as
``%%`` or ``%``.
- Unicode SQL is now passed for MySQLconnector version 2.0 and above;
for Py2k and MySQL < 2.0, strings are encoded. Note that mysqlconnector
as of 2.0.1 appears to have a bug with unicode DDL on py2k, so the tests here
are skipping until we observe it's fixed.
- take out profiling on mysqlconnector, callcounts vary too much with
its current development speed
Mike Bayer [Sat, 11 Oct 2014 22:35:12 +0000 (18:35 -0400)]
- embedding an existing predicate into a new one only
seems to be used by test_oracle->test_coerce_to_unicode(). The
predicate here should treat as a lambda based on enabled_for_config.
not sure why this test is not failing on jenkins