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
Mike Bayer [Sat, 11 Oct 2014 22:25:21 +0000 (18:25 -0400)]
- Fixed long-standing bug in Oracle dialect where bound parameter
names that started with numbers would not be quoted, as Oracle
doesn't like numerics in bound parameter names.
fixes #2138
Mike Bayer [Thu, 9 Oct 2014 21:20:30 +0000 (17:20 -0400)]
- Fixed bug where a fair number of SQL elements within
the sql package would fail to ``__repr__()`` successfully,
due to a missing ``description`` attribute that would then invoke
a recursion overflow when an internal AttributeError would then
re-invoke ``__repr__()``.
fixes #3195
Mike Bayer [Tue, 7 Oct 2014 16:43:27 +0000 (12:43 -0400)]
- adjustment for ref #3200 as we need an immutabledict() here so
that union() can be called, in the case of a dialect that uses
execution options inside of initialize() (e.g. oursql)
Mike Bayer [Mon, 6 Oct 2014 22:33:05 +0000 (18:33 -0400)]
- Fixed "'NoneType' object has no attribute 'concrete'" error
when using :class:`.AbstractConcreteBase` in conjunction with
a subclass that declares ``__abstract__``.
fixes #3185
Mike Bayer [Mon, 6 Oct 2014 22:23:42 +0000 (18:23 -0400)]
- The execution options passed to an :class:`.Engine` either via
:paramref:`.create_engine.execution_options` or
:meth:`.Engine.update_execution_options` are not passed to the
special :class:`.Connection` used to initialize the dialect
within the "first connect" event; dialects will usually
perform their own queries in this phase, and none of the
current available options should be applied here. In
particular, the "autocommit" option was causing an attempt to
autocommit within this initial connect which would fail with
an AttributeError due to the non-standard state of the
:class:`.Connection`.
fixes #3200
Mike Bayer [Mon, 29 Sep 2014 22:09:25 +0000 (18:09 -0400)]
- rework tests for attached databases into individual tests,
test both memory and file-based
- When selecting from a UNION using an attached database file,
the pysqlite driver reports column names in cursor.description
as 'dbname.tablename.colname', instead of 'tablename.colname' as
it normally does for a UNION (note that it's supposed to just be
'colname' for both, but we work around it). The column translation
logic here has been adjusted to retrieve the rightmost token, rather
than the second token, so it works in both cases. Workaround
courtesy Tony Roberts.
fixes #3211
Mike Bayer [Mon, 29 Sep 2014 21:33:53 +0000 (17:33 -0400)]
- A revisit to this issue first patched in 0.9.5, apparently
psycopg2's ``.closed`` accessor is not as reliable as we assumed,
so we have added an explicit check for the exception messages
"SSL SYSCALL error: Bad file descriptor" and
"SSL SYSCALL error: EOF detected" when detecting an
is-disconnect scenario. We will continue to consult psycopg2's
connection.closed as a first check.
fixes #3021
Mike Bayer [Fri, 19 Sep 2014 16:39:34 +0000 (12:39 -0400)]
- these tests don't test anything in SQLAlchemy - from our perpsective,
we need to be in transactions (tested elsewhere) and we need to
emit the correct FOR UPDATE strings (tested elsewhere). There's nothing
in SQLA to be tested as far as validating that for update causes exceptions
or not, and these tests frequently fail as they are timing sensitive.
Mike Bayer [Thu, 18 Sep 2014 21:49:07 +0000 (17:49 -0400)]
- Fixed bug that affected generally the same classes of event
as that of :ticket:`3199`, when the ``named=True`` parameter
would be used. Some events would fail to register, and others
would not invoke the event arguments correctly, generally in the
case of when an event was "wrapped" for adaption in some other way.
The "named" mechanics have been rearranged to not interfere with
the argument signature expected by internal wrapper functions.
fixes #3197
Mike Bayer [Thu, 18 Sep 2014 19:42:27 +0000 (15:42 -0400)]
- Fixed an unlikely race condition observed in some exotic end-user
setups, where the attempt to check for "duplicate class name" in
declarative would hit upon a not-totally-cleaned-up weak reference
related to some other class being removed; the check here now ensures
the weakref still references an object before calling upon it further.
fixes #3208
Mike Bayer [Thu, 18 Sep 2014 19:24:40 +0000 (15:24 -0400)]
- Fixed bug that affected many classes of event, particularly
ORM events but also engine events, where the usual logic of
"de duplicating" a redundant call to :func:`.event.listen`
with the same arguments would fail, for those events where the
listener function is wrapped. An assertion would be hit within
registry.py. This assertion has now been integrated into the
deduplication check, with the added bonus of a simpler means
of checking deduplication across the board.
fixes #3199
Mike Bayer [Tue, 16 Sep 2014 21:40:06 +0000 (17:40 -0400)]
- Fixed the version string detection in the pymssql dialect to
work with Microsoft SQL Azure, which changes the word "SQL Server"
to "SQL Azure".
fixes #3151
Mike Bayer [Thu, 11 Sep 2014 15:51:44 +0000 (11:51 -0400)]
- Fixed warning that would emit when a complex self-referential
primaryjoin contained functions, while at the same time remote_side
was specified; the warning would suggest setting "remote side".
It now only emits if remote_side isn't present.
fixes #3194
Mike Bayer [Wed, 10 Sep 2014 18:14:50 +0000 (14:14 -0400)]
- Fixed bug in ordering list where the order of items would be
thrown off during a collection replace event, if the
reorder_on_append flag were set to True. The fix ensures that the
ordering list only impacts the list that is explicitly associated
with the object.
fixes #3191
Docs: use the base layout when mako_layout=='epub'
- https://readthedocs.org/projects/sqlalchemy/downloads/epub/latest/ renders with the full template which is unreadable on e-readers
- in the makefile the template-variable mako_layout is set for target: epub which makes mako use only the base layout.
- this is the more elegant solution as proposed to #133
Mike Bayer [Tue, 2 Sep 2014 18:21:10 +0000 (14:21 -0400)]
- An adjustment to table/index reflection such that if an index
reports a column that isn't found to be present in the table,
a warning is emitted and the column is skipped. This can occur
for some special system column situations as has been observed
with Oracle. fixes #3180
Mike Bayer [Mon, 1 Sep 2014 00:26:40 +0000 (20:26 -0400)]
- walk back these literal SQL lectures into something much more succinct.
the ORM one in particular was really long winded and I don't really care if people
use text() anyway, they'll figure it out ;)
Matt Chisholm [Sun, 27 Jul 2014 10:15:36 +0000 (12:15 +0200)]
fix MutableDict.coerce
If a class inherited from MutableDict (say, for instance, to add an update() method), coerce() would give back an instance of MutableDict instead of an instance of the derived class.
Add note on begin_nested requiring rollback/commit
Avoid confusion about rollback/commit "must be issued" after
``session.begin_nested()`` --- this might be taken to mean call must be
*added*, but that's only true if not using the return value as a context
manager.
Mike Bayer [Wed, 20 Aug 2014 16:01:20 +0000 (12:01 -0400)]
- Fixed bug in connection pool logging where the "connection checked out"
debug logging message would not emit if the logging were set up using
``logging.setLevel()``, rather than using the ``echo_pool`` flag.
Tests to assert this logging have been added. This is a
regression that was introduced in 0.9.0.
fixes #3168
Mike Bayer [Fri, 15 Aug 2014 18:57:29 +0000 (14:57 -0400)]
- TIL that dict.keys() in py3K is not an iterator, it is an iterable
view. So copy collections.OrderedDict and use MutableMapping to set up
keys, items, values on our own OrderedDict.
Mike Bayer [Fri, 15 Aug 2014 00:00:35 +0000 (20:00 -0400)]
- The string keys that are used to determine the columns impacted
for an INSERT or UPDATE are now sorted when they contribute towards
the "compiled cache" cache key. These keys were previously not
deterministically ordered, meaning the same statement could be
cached multiple times on equivalent keys, costing both in terms of
memory as well as performance.
fixes #3165
Mike Bayer [Thu, 7 Aug 2014 14:43:55 +0000 (10:43 -0400)]
-Fixed bug where Postgresql JSON type was not able to persist or
otherwise render a SQL NULL column value, rather than a JSON-encoded
``'null'``. To support this case, changes are as follows:
* The value :func:`.null` can now be specified, which will always
result in a NULL value resulting in the statement.
* A new parameter :paramref:`.JSON.none_as_null` is added, which
when True indicates that the Python ``None`` value should be
peristed as SQL NULL, rather than JSON-encoded ``'null'``.
Retrival of NULL as None is also repaired for DBAPIs other than
psycopg2, namely pg8000.