Mike Bayer [Fri, 15 Aug 2014 19:13:13 +0000 (15:13 -0400)]
- The :class:`.IdentityMap` exposed from :class:`.Session.identity`
now returns lists for ``items()`` and ``values()`` in Py3K.
Early porting to Py3K here had these returning iterators, when
they technically should be "iterable views"..for now, lists are OK.
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 18:27:12 +0000 (14:27 -0400)]
- don't add the parent attach event within _on_table_attach
if we already have a table; this prevents reentrant calls and
we aren't supporting columns/etc being moved around between different parents
Mike Bayer [Fri, 15 Aug 2014 00:47:49 +0000 (20:47 -0400)]
- UPDATE statements can now be batched within an ORM flush
into more performant executemany() call, similarly to how INSERT
statements can be batched; this will be invoked within flush
to the degree that subsequent UPDATE statements for the
same mapping and table involve the identical columns within the
VALUES clause, as well as that no VALUES-level SQL expressions
are embedded.
- some other inlinings within persistence.py
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, 14 Aug 2014 18:40:28 +0000 (14:40 -0400)]
- Removing (or adding) an event listener at the same time that the event
is being run itself, either from inside the listener or from a
concurrent thread, now raises a RuntimeError, as the collection used is
now an instance of ``colletions.deque()`` and does not support changes
while being iterated. Previously, a plain Python list was used where
removal from inside the event itself would produce silent failures.
fixes #3163
Mike Bayer [Wed, 13 Aug 2014 23:45:34 +0000 (19:45 -0400)]
- The ``info`` parameter has been added to the constructor for
:class:`.SynonymProperty` and :class:`.ComparableProperty`.
- The ``info`` parameter has been added as a constructor argument
to all schema constructs including :class:`.MetaData`,
:class:`.Index`, :class:`.ForeignKey`, :class:`.ForeignKeyConstraint`,
:class:`.UniqueConstraint`, :class:`.PrimaryKeyConstraint`,
:class:`.CheckConstraint`.
Mike Bayer [Wed, 13 Aug 2014 23:20:44 +0000 (19:20 -0400)]
- The :meth:`.InspectionAttr.info` collection is now moved down to
:class:`.InspectionAttr`, where in addition to being available
on all :class:`.MapperProperty` objects, it is also now available
on hybrid properties, association proxies, when accessed via
:attr:`.Mapper.all_orm_descriptors`.
fixes #2971
Mike Bayer [Wed, 13 Aug 2014 21:42:33 +0000 (17:42 -0400)]
- public method name is get_enums()
- return a list of dicts like other methods do
- don't combine 'schema' with 'name', leave them separate
- support '*' argument so that we can retrieve cross-schema
if needed
- remove "conn" argument
- use bound parameters for 'schema' in SQL
- order by schema, name, label
- adapt _load_enums changes to column reflection
- changelog
- module docs for get_enums()
- add drop of enums to --dropfirst
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.
Mike Bayer [Sat, 2 Aug 2014 18:42:57 +0000 (14:42 -0400)]
- Fixed bug in CTE where ``literal_binds`` compiler argument would not
be always be correctly propagated when one CTE referred to another
aliased CTE in a statement.
Fixes #3154
Tony Locke [Sat, 26 Jul 2014 19:10:36 +0000 (20:10 +0100)]
two_phase_recover, COMMIT PREPARED in transaction
In test/engine/test_transaction/test_two_phase_recover(), a COMMIT
PREPARED is issued while in a transaction. This causes an error, and
a prepared transaction is left hanging around which causes
the subsequent test to hang. I've altered the test to execute the
offending query with autocommit=true, then when it gets to the COMMIT
PRPARED it can go ahead.
There's another complication for pg8000 because its tpc_recover() method
started a transaction if one wasn't already in progress. I've decided
that this is incorrect behaviour and so from pg8000-1.9.13 this method
never starts or stops a transaction.
Tony Locke [Sat, 26 Jul 2014 15:19:09 +0000 (16:19 +0100)]
With pg8000-1.9.13 passes engine/test_reconnect
The pg8000 dialect checks the text of the exception to determine if the
connection is closed. I'd (recklessly!) changed the text of the
exception in a recent version of the pg8000 driver adding capitalization
and a full stop. I've changed it back now so all works.
Mike Bayer [Tue, 29 Jul 2014 18:06:43 +0000 (14:06 -0400)]
- The exception wrapping system for DBAPI errors can now accommodate
non-standard DBAPI exceptions, such as the psycopg2
TransactionRollbackError. These exceptions will now be raised
using the closest available subclass in ``sqlalchemy.exc``, in the
case of TransactionRollbackError, ``sqlalchemy.exc.OperationalError``.
fixes #3075
Mike Bayer [Tue, 29 Jul 2014 17:32:05 +0000 (13:32 -0400)]
- Fixed 0.9.7 regression caused by :ticket:`3067` in conjunction with
a mis-named unit test such that so-called "schema" types like
:class:`.Boolean` and :class:`.Enum` could no longer be pickled.
fixes #3144
Mike Bayer [Fri, 25 Jul 2014 20:08:21 +0000 (16:08 -0400)]
- Fixed bug in :class:`.postgresql.array` object where comparison
to a plain Python list would fail to use the correct array constructor.
Pull request courtesy Andrew. fixes #3141
Mike Bayer [Fri, 25 Jul 2014 16:14:22 +0000 (12:14 -0400)]
- The MySQL dialect will now disable :meth:`.ConnectionEvents.handle_error`
events from firing for those statements which it uses internally
to detect if a table exists or not. This is achieved using an
execution option ``skip_user_error_events`` that disables the handle
error event for the scope of that execution. In this way, user code
that rewrites exceptions doesn't need to worry about the MySQL
dialect or other dialects that occasionally need to catch
SQLAlchemy specific exceptions.
Mike Bayer [Thu, 24 Jul 2014 18:33:50 +0000 (14:33 -0400)]
- Added a supported :meth:`.FunctionElement.alias` method to functions,
e.g. the ``func`` construct. Previously, behavior for this method
was undefined. The current behavior mimics that of pre-0.9.4,
which is that the function is turned into a single-column FROM
clause with the given alias name, where the column itself is
anonymously named.
fixes #3137
Andrew [Thu, 24 Jul 2014 05:56:50 +0000 (15:56 +1000)]
Fix argument to array() in array._bind_param()
array.__init__() expects a list as its sole parameter but inside _bind_param(), instead of sending a list it's sending each item in the list as a separate argument which is incorrect.
Mike Bayer [Mon, 21 Jul 2014 15:58:44 +0000 (11:58 -0400)]
- Fixed bug introduced in 0.9.5 by new pg8000 isolation level feature
where engine-level isolation level parameter would raise an error
on connect. fixes #3134