Mike Bayer [Wed, 28 Aug 2013 01:37:22 +0000 (21:37 -0400)]
- cx_oracle seems to have a bug here though it is hard to track down
- cx_oracle dialect doesn't use normal col names, lets just not rely on that for now
Mike Bayer [Wed, 28 Aug 2013 00:43:22 +0000 (20:43 -0400)]
- A rework to the way that "quoted" identifiers are handled, in that
instead of relying upon various ``quote=True`` flags being passed around,
these flags are converted into rich string objects with quoting information
included at the point at which they are passed to common schema constructs
like :class:`.Table`, :class:`.Column`, etc. This solves the issue
of various methods that don't correctly honor the "quote" flag such
as :meth:`.Engine.has_table` and related methods. The :class:`.quoted_name`
object is a string subclass that can also be used explicitly if needed;
the object will hold onto the quoting preferences passed and will
also bypass the "name normalization" performed by dialects that
standardize on uppercase symbols, such as Oracle, Firebird and DB2.
The upshot is that the "uppercase" backends can now work with force-quoted
names, such as lowercase-quoted names and new reserved words.
[ticket:2812]
Mike Bayer [Sun, 25 Aug 2013 21:37:59 +0000 (17:37 -0400)]
- ensure rowcount is returned for an UPDATE with no implicit returning
- modernize test for that
- use py3k compatible next() in test_returning/test_versioning
Mike Bayer [Sun, 25 Aug 2013 18:03:54 +0000 (14:03 -0400)]
- The ``version_id_generator`` parameter of ``Mapper`` can now be specified
to rely upon server generated version identifiers, using triggers
or other database-provided versioning features, by passing the value
``False``. The ORM will use RETURNING when available to immediately
load the new version identifier, else it will emit a second SELECT.
[ticket:2793]
- The ``eager_defaults`` flag of :class:`.Mapper` will now allow the
newly generated default values to be fetched using an inline
RETURNING clause, rather than a second SELECT statement, for backends
that support RETURNING.
- Added a new variant to :meth:`.ValuesBase.returning` called
:meth:`.ValuesBase.return_defaults`; this allows arbitrary columns
to be added to the RETURNING clause of the statement without interfering
with the compilers usual "implicit returning" feature, which is used to
efficiently fetch newly generated primary key values. For supporting
backends, a dictionary of all fetched values is present at
:attr:`.ResultProxy.returned_defaults`.
- add a glossary entry for RETURNING
- add documentation for version id generation, [ticket:867]
Mike Bayer [Sat, 24 Aug 2013 17:55:14 +0000 (13:55 -0400)]
- The :class:`.CreateColumn` construct can be appled to a custom
compilation rule which allows skipping of columns, by producing
a rule that returns ``None``. Also in 0.8.3.
Mike Bayer [Sat, 24 Aug 2013 15:27:44 +0000 (11:27 -0400)]
- "primary mapper entity" is now an attribute on Query,
making _MapperEntity slightly less dependent on a particular parent
Query (in theory more shareable by multiple Query objects in different contexts)
- remove some comments that have been misunderstanding what _mapper_entities
does, or perhaps forgot to get removed
- simplify _mapper_entities
Mike Bayer [Tue, 20 Aug 2013 17:27:27 +0000 (13:27 -0400)]
Fixed bug where list instrumentation would fail to represent a
setslice of ``[0:0]`` correctly, which in particular could occur
when using ``insert(0, item)`` with the association proxy. Due
to some quirk in Python collections, the issue was much more likely
with Python 3 rather than 2. Also in 0.8.3, 0.7.11.
[ticket:2807]
Mike Bayer [Sun, 18 Aug 2013 22:01:27 +0000 (18:01 -0400)]
- reorganize docs so expression, schema are broken out into subfiles, they're too big
- fix the targeting of module names moved around by using custom handlers for "Bases", etc.
Mike Bayer [Sun, 18 Aug 2013 19:34:23 +0000 (15:34 -0400)]
Fixed a potential issue in an ordered sequence implementation used
by the ORM to iterate mapper hierarchies; under the Jython interpreter
this implementation wasn't ordered, even though cPython and Pypy
maintained ordering. Also in 0.8.3.
[ticket:2794]
Mike Bayer [Sun, 18 Aug 2013 18:46:04 +0000 (14:46 -0400)]
Fixed regression dating back to 0.7.9 whereby the name of a CTE might
not be properly quoted if it was referred to in multiple FROM clauses.
Also in 0.8.3, 0.7.11. [ticket:2801]
Mike Bayer [Wed, 14 Aug 2013 23:58:34 +0000 (19:58 -0400)]
- apply an import refactoring to the ORM as well
- rework the event system so that event modules load after their
targets, dependencies are reversed
- create an improved strategy lookup system for the ORM
- rework the ORM to have very few import cycles
- move out "importlater" to just util.dependency
- other tricks to cross-populate modules in as clear a way as possible
Mike Bayer [Mon, 12 Aug 2013 21:50:37 +0000 (17:50 -0400)]
- A large refactoring of the ``sqlalchemy.sql`` package has reorganized
the import structure of many core modules.
``sqlalchemy.schema`` and ``sqlalchemy.types``
remain in the top-level package, but are now just lists of names
that pull from within ``sqlalchemy.sql``. Their implementations
are now broken out among ``sqlalchemy.sql.type_api``, ``sqlalchemy.sql.sqltypes``,
``sqlalchemy.sql.schema`` and ``sqlalchemy.sql.ddl``, the last of which was
moved from ``sqlalchemy.engine``. ``sqlalchemy.sql.expression`` is also
a namespace now which pulls implementations mostly from ``sqlalchemy.sql.elements``,
``sqlalchemy.sql.selectable``, and ``sqlalchemy.sql.dml``.
Most of the "factory" functions
used to create SQL expression objects have been moved to classmethods
or constructors, which are exposed in ``sqlalchemy.sql.expression``
using a programmatic system. Care has been taken such that all the
original import namespaces remain intact and there should be no impact
on any existing applications. The rationale here was to break out these
very large modules into smaller ones, provide more manageable lists
of function names, to greatly reduce "import cycles" and clarify the
up-front importing of names, and to remove the need for redundant
functions and documentation throughout the expression package.
Mike Bayer [Wed, 7 Aug 2013 18:28:45 +0000 (13:28 -0500)]
- The :meth:`.Operators.notin_` operator added in 0.8 now properly
produces the negation of the expression "IN" returns
when used against an empty collection. Also in 0.8.3.
Mike Bayer [Fri, 2 Aug 2013 22:21:02 +0000 (18:21 -0400)]
- after discussions with the original project folks working with zope security
proxies, they aren't overriding getattr() or setattr() at all. so all the
hardcoded getattr()/setattr() is removed from collections.py. Lots of these
getattr/setattr were against the attributeimpl and decorated functions
and don't seem like they'd ever be needed; for a user that needs special access
to a collection, we can evaulate that use case and add a single point of
"unwrapping", and probably add a hook for it via
InstrumentationManager so that the collection implementation isn't complicated
by it.
Mike Bayer [Fri, 2 Aug 2013 17:27:30 +0000 (13:27 -0400)]
a missing cursor.close() here caused a *huge* amount of weird locking issues with pypy,
what is strange is how it only occurred in some very specific places under very
particular conditions, perhaps it has to do with whether or not this cursor gets
gc'ed or not.
Mike Bayer [Fri, 2 Aug 2013 16:39:29 +0000 (12:39 -0400)]
Added a new attribute :attr:`.Session.info` to :class:`.Session`;
this is a dictionary where applications can store arbitrary
data local to a :class:`.Session`.
The contents of :attr:`.Session.info` can be also be initialized
using the ``info`` argument of :class:`.Session` or
:class:`.sessionmaker`.
Mike Bayer [Fri, 2 Aug 2013 00:25:56 +0000 (20:25 -0400)]
- assorted fixes raised by pypy 2.1beta2, but all of which are good
ideas in general:
- pypy2.1 w/ sqlite3 is the first DBAPI we're seeing returning
unicode in cursor.description without being py3k. add a new on-connect
check for this, if we get back a u"", just don't do description decoding,
should be OK for now.
- the set tests in test_collection were assuming the two sets would be ordered
the same when it tested pop(), can't really assume that.
- test_serializer gets worse and worse, pickle is just not really viable here,
ding out pypy
- pypy2.1b2 seems to allow cursor.lastrowid to work (or we changed something?)
- pool._threadconns.current() is a weakref, it can be None
- another one of those logging.handlers imports
Mike Bayer [Wed, 31 Jul 2013 22:42:58 +0000 (18:42 -0400)]
- Fixed bug in common table expression system where if the CTE were
used only as an ``alias()`` construct, it would not render using the
WITH keyword. Also in 0.8.3, 0.7.11.
[ticket:2783]
Mike Bayer [Sat, 27 Jul 2013 21:05:01 +0000 (17:05 -0400)]
- fix issue in join rewriting whereby we need to ensure the .key and .name
are transferred correctly for when .key is present; tests have been enhanced
to test this condition for render, result map construction, statement
execution. [ticket:2790]
Mike Bayer [Fri, 26 Jul 2013 23:11:33 +0000 (19:11 -0400)]
- add event.contains() function to the event package, returns True
if the given target/event/fn is set up to listen.
- repair mutable package which is doing some conditional event listening
Mike Bayer [Fri, 26 Jul 2013 18:21:58 +0000 (14:21 -0400)]
- Removal of event listeners is now implemented. The feature is
provided via the :func:`.event.remove` function.
[ticket:2268]
- reorganization of event.py module into a package; with the addition of the
docstring work as well as the new registry for removal, there's a lot more code now.
the package separates concerns and provides a top-level doc for each subsection
of functionality
- the remove feature works by providing the EventKey object which associates
the user-provided arguments to listen() with a global, weak-referencing registry.
This registry stores a collection of _ListenerCollection and _DispatchDescriptor
objects associated with each set of arguments, as well as the wrapped function
which was applied to that collection. The EventKey can then be recreated for
a removal, all the _ListenerCollection and _DispatchDescriptor objects are located,
and the correct wrapped function is removed from each one.
Mike Bayer [Fri, 26 Jul 2013 04:01:04 +0000 (00:01 -0400)]
- The mechanism by which attribute events pass along an
:class:`.AttributeImpl` as an "initiator" token has been changed;
the object is now an event-specific object called :class:`.attributes.Event`.
Additionally, the attribute system no longer halts events based
on a matching "initiator" token; this logic has been moved to be
specific to ORM backref event handlers, which are the typical source
of the re-propagation of an attribute event onto subsequent append/set/remove
operations. End user code which emulates the behavior of backrefs
must now ensure that recursive event propagation schemes are halted,
if the scheme does not use the backref handlers. Using this new system,
backref handlers can now peform a
"two-hop" operation when an object is appended to a collection,
associated with a new many-to-one, de-associated with the previous
many-to-one, and then removed from a previous collection. Before this
change, the last step of removal from the previous collection would
not occur.
[ticket:2789]
Mike Bayer [Sat, 20 Jul 2013 02:56:34 +0000 (22:56 -0400)]
- Improved the examples in ``examples/generic_associations``, including
that ``discriminator_on_association.py`` makes use of single table
inheritance do the work with the "discriminator". Also
added a true "generic foreign key" example, which works similarly
to other popular frameworks in that it uses an open-ended integer
to point to any other table, foregoing traditional referential
integrity. While we don't recommend this pattern, information wants
to be free. Also in 0.8.3.
- Added a convenience class decorator :func:`.as_declarative`, is
a wrapper for :func:`.declarative_base` which allows an existing base
class to be applied using a nifty class-decorated approach. Also
in 0.8.3.
Mike Bayer [Fri, 19 Jul 2013 03:17:33 +0000 (23:17 -0400)]
Fixed bug in ORM-level event registration where the "raw" or
"propagate" flags could potentially be mis-configured in some
"unmapped base class" configurations. Also in 0.8.3.
[ticket:2786]
Mike Bayer [Wed, 17 Jul 2013 15:18:59 +0000 (11:18 -0400)]
Fixed bug in :class:`.CheckConstraint` DDL where the "quote" flag from a
:class:`.Column` object would not be propagated. Also in 0.8.3, 0.7.11.
[ticket:2784]
Mike Bayer [Sat, 13 Jul 2013 20:28:42 +0000 (16:28 -0400)]
A performance fix related to the usage of the :func:`.defer` option
when loading mapped entities. The function overhead of applying
a per-object deferred callable to an instance at load time was
significantly higher than that of just loading the data from the row
(note that ``defer()`` is meant to reduce DB/network overhead, not
necessarily function call count); the function call overhead is now
less than that of loading data from the column in all cases. There
is also a reduction in the number of "lazy callable" objects created
per load from N (total deferred values in the result) to 1 (total
number of deferred cols).
[ticket:2778]
Mike Bayer [Sat, 13 Jul 2013 01:52:54 +0000 (21:52 -0400)]
The newly added SQLite DATETIME arguments storage_format and
regexp apparently were not fully implemented correctly; while the
arguments were accepted, in practice they would have no effect;
this has been fixed. Also in 0.8.3.
[ticket:2781]