Mike Bayer [Fri, 11 Oct 2013 20:41:52 +0000 (16:41 -0400)]
- fix bug due to regression from #2793, make sure we only go to load
scalar attributes here and not relationships, else we get an error if there's no
actual scalars to load
Mike Bayer [Fri, 11 Oct 2013 20:16:08 +0000 (16:16 -0400)]
The ``default`` argument of :class:`.Column` now accepts a class
or object method as an argument, in addition to a standalone function;
will properly detect if the "context" argument is accepted or not.
Mike Bayer [Fri, 11 Oct 2013 19:55:57 +0000 (15:55 -0400)]
The "name" attribute is set on :class:`.Index` before the "attach"
events are called, so that attachment events can be used to dynamically
generate a name for the index based on the parent table and/or
columns. [ticket:2835]
Mike Bayer [Fri, 11 Oct 2013 16:48:46 +0000 (12:48 -0400)]
- The method signature of :meth:`.Dialect.reflecttable`, which in
all known cases is provided by :class:`.DefaultDialect`, has been
tightened to expect ``include_columns`` and ``exclude_columns``
arguments without any kw option, reducing ambiguity - previously
``exclude_columns`` was missing. [ticket:2748]
Mike Bayer [Wed, 9 Oct 2013 00:06:58 +0000 (20:06 -0400)]
A :func:`.select` that is made to refer to itself in its FROM clause,
typically via in-place mutation, will raise an informative error
message rather than causing a recursion overflow.
[ticket:2815]
Mike Bayer [Tue, 8 Oct 2013 23:47:13 +0000 (19:47 -0400)]
Fixed bug where using an annotation such as :func:`.remote` or
:func:`.foreign` on a :class:`.Column` before association with a parent
:class:`.Table` could produce issues related to the parent table not
rendering within joins, due to the inherent copy operation performed
by an annotation. [ticket:2813]
Mike Bayer [Tue, 8 Oct 2013 23:20:09 +0000 (19:20 -0400)]
The erroneous kw arg "schema" has been removed from the :class:`.ForeignKey`
object. this was an accidental commit that did nothing; a warning is raised
in 0.8.3 when this kw arg is used. [ticket:2831]
Mike Bayer [Mon, 7 Oct 2013 00:29:08 +0000 (20:29 -0400)]
- merge ticket_1418 branch, [ticket:1418]
- The system of loader options has been entirely rearchitected to build
upon a much more comprehensive base, the :class:`.Load` object. This
base allows any common loader option like :func:`.joinedload`,
:func:`.defer`, etc. to be used in a "chained" style for the purpose
of specifying options down a path, such as ``joinedload("foo").subqueryload("bar")``.
The new system supersedes the usage of dot-separated path names,
multiple attributes within options, and the usage of ``_all()`` options.
- Added a new load option :func:`.orm.load_only`. This allows a series
of column names to be specified as loading "only" those attributes,
deferring the rest.
Mike Bayer [Sun, 6 Oct 2013 03:47:49 +0000 (23:47 -0400)]
- fix propagation of quote flag within _gen_label() so that if the
name is already an instance of _anonymous_label(), we don't downgrade
it to a plain quoted_name - fixes regression from [ticket:2812].
[ticket:2834]
Mike Bayer [Thu, 3 Oct 2013 21:06:55 +0000 (17:06 -0400)]
- A new construct :class:`.Bundle` is added, which allows for specification
of groups of column expressions to a :class:`.Query` construct.
The group of columns are returned as a single tuple by default. The
behavior of :class:`.Bundle` can be overridden however to provide
any sort of result processing to the returned row. One example included
is :attr:`.Composite.Comparator.bundle`, which applies a bundled form
of a "composite" mapped attribute.
[ticket:2824]
- The :func:`.composite` construct now maintains the return object
when used in a column-oriented :class:`.Query`, rather than expanding
out into individual columns. This makes use of the new :class:`.Bundle`
feature internally. This behavior is backwards incompatible; to
select from a composite column which will expand out, use
``MyClass.some_composite.clauses``.
Mike Bayer [Sat, 7 Sep 2013 01:39:36 +0000 (21:39 -0400)]
- modify what we did in [ticket:2793] so that we can also set the
version id programmatically outside of the generator. using this system,
we can also leave the version id alone.
Mike Bayer [Wed, 28 Aug 2013 21:25:44 +0000 (17:25 -0400)]
Fixed bug where using the ``column_reflect`` event to change the ``.key``
of the incoming :class:`.Column` would prevent primary key constraints,
indexes, and foreign key constraints from being correctly reflected.
Also in 0.8.3. [ticket:2811]
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.