summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/orm/base.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2013-10-06 20:29:08 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2013-10-06 20:29:08 -0400
commit1b25ed907fb7311d28d2273c9b9858b50c1a7afc (patch)
tree74bd8df8638dbd1f1e48b1ca660963944be0be3d /lib/sqlalchemy/orm/base.py
parentd79e1d69a6b2d0d1cc18d3d9d0283ef4a77925bc (diff)
downloadsqlalchemy-1b25ed907fb7311d28d2273c9b9858b50c1a7afc.tar.gz
- 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.
Diffstat (limited to 'lib/sqlalchemy/orm/base.py')
-rw-r--r--lib/sqlalchemy/orm/base.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/sqlalchemy/orm/base.py b/lib/sqlalchemy/orm/base.py
index f7d9dd4fe..47d8796b8 100644
--- a/lib/sqlalchemy/orm/base.py
+++ b/lib/sqlalchemy/orm/base.py
@@ -129,6 +129,19 @@ NOT_EXTENSION = util.symbol('NOT_EXTENSION')
_none_set = frozenset([None])
+def _generative(*assertions):
+ """Mark a method as generative, e.g. method-chained."""
+
+ @util.decorator
+ def generate(fn, *args, **kw):
+ self = args[0]._clone()
+ for assertion in assertions:
+ assertion(self, fn.__name__)
+ fn(self, *args[1:], **kw)
+ return self
+ return generate
+
+
# these can be replaced by sqlalchemy.ext.instrumentation
# if augmented class instrumentation is enabled.
def manager_of_class(cls):