From: Mike Bayer Date: Sat, 11 Jul 2009 21:07:52 +0000 (+0000) Subject: updates X-Git-Tag: rel_0_5_5~3 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=eeecbb8fc66bcb62439a3539c01e4186a1698a19;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git updates --- diff --git a/doc/build/mappers.rst b/doc/build/mappers.rst index 2dcd52fb3b..2431cebce2 100644 --- a/doc/build/mappers.rst +++ b/doc/build/mappers.rst @@ -883,6 +883,7 @@ Multiple extensions will be chained together and processed in order; they are sp Relation Configuration ======================= + Basic Relational Patterns -------------------------- @@ -1339,6 +1340,8 @@ To enable the UPDATE after INSERT / UPDATE before DELETE behavior on ``relation( When a structure using the above mapping is flushed, the "widget" row will be INSERTed minus the "favorite_entry_id" value, then all the "entry" rows will be INSERTed referencing the parent "widget" row, and then an UPDATE statement will populate the "favorite_entry_id" column of the "widget" table (it's one row at a time for the time being). +.. _advdatamapping_entitycollections: + Alternate Collection Implementations ------------------------------------- @@ -1354,7 +1357,7 @@ Mapping a one-to-many or many-to-many relationship results in a collection of va parent.children.append(Child()) print parent.children[0] -Collections are not limited to lists. Sets, mutable sequences and almost any other Python object that can act as a container can be used in place of the default list. +Collections are not limited to lists. Sets, mutable sequences and almost any other Python object that can act as a container can be used in place of the default list, by specifying the ``collection_class`` option on ``relation()``. .. sourcecode:: python+sql @@ -1368,7 +1371,6 @@ Collections are not limited to lists. Sets, mutable sequences and almost any ot parent.children.add(child) assert child in parent.children -.. _advdatamapping_entitycollections: Custom Collection Implementations ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -1524,8 +1526,7 @@ The collections package provides additional decorators and support for authoring Configuring Loader Strategies: Lazy Loading, Eager Loading ----------------------------------------------------------- - -In the `datamapping`, we introduced the concept of **Eager Loading**. We used an ``option`` in conjunction with the ``Query`` object in order to indicate that a relation should be loaded at the same time as the parent, within a single SQL query: +In the :ref:`ormtutorial_toplevel`, we introduced the concept of **Eager Loading**. We used an ``option`` in conjunction with the ``Query`` object in order to indicate that a relation should be loaded at the same time as the parent, within a single SQL query: .. sourcecode:: python+sql @@ -1537,7 +1538,7 @@ In the `datamapping`, we introduced the concept of **Eager Loading**. We used a WHERE users.name = ? ['jack'] -By default, all relations are **lazy loading**. The scalar or collection attribute associated with a ``relation()`` contains a trigger which fires the first time the attribute is accessed, which issues a SQL call at that point: +By default, all inter-object relationships are **lazy loading**. The scalar or collection attribute associated with a ``relation()`` contains a trigger which fires the first time the attribute is accessed, which issues a SQL call at that point: .. sourcecode:: python+sql diff --git a/doc/build/reference/sqlalchemy/pooling.rst b/doc/build/reference/sqlalchemy/pooling.rst index c7447869a4..91e9681978 100644 --- a/doc/build/reference/sqlalchemy/pooling.rst +++ b/doc/build/reference/sqlalchemy/pooling.rst @@ -134,7 +134,7 @@ The ``close()`` method will return the connection to the pool, and the ``cursor()`` method will return a proxied cursor object. Both the connection proxy and the cursor proxy will also return the underlying connection to the pool after they have both been garbage collected, -which is detected via the ``__del__()`` method. +which is detected via weakref callbacks (``__del__`` is not used). Additionally, when connections are returned to the pool, a ``rollback()`` is issued on the connection unconditionally. This is diff --git a/doc/build/sqlexpression.rst b/doc/build/sqlexpression.rst index 4d54d036bd..387013cacc 100644 --- a/doc/build/sqlexpression.rst +++ b/doc/build/sqlexpression.rst @@ -784,7 +784,12 @@ SQL functions are created using the ``func`` keyword, which generates functions >>> print func.concat('x', 'y') concat(:param_1, :param_2) -Certain functions are marked as "ANSI" functions, which mean they don't get the parenthesis added after them, such as CURRENT_TIMESTAMP: +By "generates", we mean that **any** SQL function is created based on the word you choose:: + + >>> print func.xyz_my_goofy_function() + xyz_my_goofy_function() + +Certain function names are known by SQLAlchemy, allowing special behavioral rules to be applied. Some for example are "ANSI" functions, which mean they don't get the parenthesis added after them, such as CURRENT_TIMESTAMP: .. sourcecode:: pycon+sql