]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
various cleanup etc.
authorMike Bayer <mike_mp@zzzcomputing.com>
Wed, 4 Oct 2006 00:00:22 +0000 (00:00 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Wed, 4 Oct 2006 00:00:22 +0000 (00:00 +0000)
CHANGES
doc/build/compile_docstrings.py
doc/build/content/plugins.txt
lib/sqlalchemy/attributes.py
lib/sqlalchemy/orm/__init__.py
lib/sqlalchemy/orm/interfaces.py
lib/sqlalchemy/orm/mapper.py

diff --git a/CHANGES b/CHANGES
index 0f6ca8a04dc1a73b5fa75e5c50bee2074e194834..9b2d2af550a94f9d803cdf2821507c8df92a87f6 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,4 +1,4 @@
-0.2.9
+0.3.0
 - General:
     - logging is now implemented via standard python "logging" module.
     "echo" keyword parameters are still functional but set/unset
@@ -6,7 +6,7 @@
     can be controlled directly through the Python API by setting
     INFO and DEBUG levels for loggers in the "sqlalchemy" namespace.
     class-level logging is under "sqlalchemy.<module>.<classname>",
-    instance-level logging under "sqlalchemy.<module>.<classname>.<hexid>".
+    instance-level logging under "sqlalchemy.<module>.<classname>.0x..<00-FF>".
     Test suite includes "--log-info" and "--log-debug" arguments
     which work independently of --verbose/--quiet.  Logging added
     to orm to allow tracking of mapper configurations, row iteration.
     ColumnProperty and PropertyLoader define their loading behaivor via switchable
     "strategies", and MapperOptions no longer use mapper/property copying 
     in order to function; they are instead propigated via QueryContext
-    and SelectionContext objects at query/instnaces time.
-    All of the copying of mappers and properties that was used to handle
+    and SelectionContext objects at query/instances time.
+    All of the internal copying of mappers and properties that was used to handle
     inheritance as well as options() has been removed; the structure
-    of mappers and properties is simpler than before and clearly laid out.
+    of mappers and properties is much simpler than before and is clearly laid out
+    in the new 'interfaces' module.
     - related to the mapper/property overhaul, internal refactoring to 
     mapper instances() method to use a SelectionContext object to track 
     state during the operation.
index 528da388a8e150ba78a64680edfae92aa5c43f1b..59909d8f26a6885c726a01709a06620e35e71982 100644 (file)
@@ -21,12 +21,10 @@ objects = []
 def make_doc(obj, classes=None, functions=None):
     objects.append(docstring.ObjectDoc(obj, classes=classes, functions=functions))
     
-make_doc(obj=sql, classes=[sql.Engine, sql.AbstractDialect, sql.ClauseParameters, sql.Compiled, sql.ClauseElement, sql.TableClause, sql.ColumnClause])
+make_doc(obj=sql, classes=[])
 make_doc(obj=schema)
 make_doc(obj=engine, classes=[engine.Connectable, engine.ComposedSQLEngine, engine.Connection, engine.Transaction, engine.Dialect, engine.ConnectionProvider, engine.ExecutionContext, engine.ResultProxy, engine.RowProxy])
-make_doc(obj=strategies)
-make_doc(obj=orm, classes=[orm.Mapper, orm.MapperExtension, orm.SelectionContext])
-make_doc(obj=orm.query, classes=[orm.query.Query])
+make_doc(obj=orm)
 make_doc(obj=orm.session, classes=[orm.session.Session, orm.session.SessionTransaction])
 make_doc(obj=pool, classes=[pool.DBProxy, pool.Pool, pool.QueuePool, pool.SingletonThreadPool])
 make_doc(obj=sessioncontext)
index 31dc8c43b459537682d73be2137ff7e2b5ab99bb..565a3aea01114936b39372138c80a9ad62ba8f34 100644 (file)
@@ -7,7 +7,7 @@ SQLAlchemy has a variety of extensions and "mods" available which provide extra
 
 **Author:**  Daniel Miller
 
-This plugin is used to instantiate and manage Session objects.  It provides several services:
+This plugin is used to instantiate and manage Session objects.  As of SQLAlchemy 0.2 it is the preferred way to provide thread-local session functionality to an application.  It provides several services:
 
 * serves as a factory to create sessions of a particular configuration.  This factory may either call `create_session()` with a particular set of arguments, or instantiate a different implementation of `Session` if one is available.
 * for the `Session` objects it creates, provides the ability to maintain a single `Session` per distinct application thread.  The `Session` returned by a `SessionContext` is called the *contextual session.*   Providing at least a thread-local context to sessions is important because the `Session` object is not threadsafe, and is intended to be used with localized sets of data, as opposed to a single session being used application wide.
index 7628aa09809fec9df54538bdd39b7147f648bfc3..388c10bceec9c04ab3792fed66defa20b9a33f74 100644 (file)
@@ -675,7 +675,6 @@ class AttributeManager(object):
         the callable will only be executed if the given 'passive' flag is False.
         """
         attr = getattr(obj.__class__, key)
-        print "ATTR IS A", attr, "OBJ IS A", obj
         x = attr.get(obj, passive=passive)
         if x is InstrumentedAttribute.PASSIVE_NORESULT:
             return []
index b00151e9431fd66a71bb0a78a8f672dacd51185d..7339d0fabf13c3402942c5b1c1cbd623f4c6f314 100644 (file)
@@ -11,6 +11,7 @@ packages and tying operations to class properties and constructors.
 from sqlalchemy import sql, schema, engine, util, exceptions
 from mapper import *
 from mapper import mapper_registry
+import mapper as mapperlib
 from query import Query
 from util import polymorphic_union
 import properties, strategies
@@ -36,35 +37,35 @@ def backref(name, **kwargs):
     return properties.BackRef(name, **kwargs)
     
 def deferred(*columns, **kwargs):
-    """returns a DeferredColumnProperty, which indicates this object attributes should only be loaded 
+    """return a DeferredColumnProperty, which indicates this object attributes should only be loaded 
     from its corresponding table column when first accessed."""
     return properties.ColumnProperty(deferred=True, *columns, **kwargs)
     
 def mapper(class_, table=None, *args, **params):
-    """returns a newMapper object."""
+    """return a new Mapper object."""
     return Mapper(class_, table, *args, **params)
 
 def synonym(name):
     return SynonymProperty(name)
     
 def clear_mappers():
-    """removes all mappers that have been created thus far.  when new mappers are 
+    """remove all mappers that have been created thus far.  when new mappers are 
     created, they will be assigned to their classes as their primary mapper."""
     mapper_registry.clear()
     
 def clear_mapper(m):
-    """removes the given mapper from the storage of mappers.  when a new mapper is 
+    """remove the given mapper from the storage of mappers.  when a new mapper is 
     created for the previous mapper's class, it will be used as that classes' 
     new primary mapper."""
     del mapper_registry[m.hash_key]
 
 def eagerload(name):
-    """returns a MapperOption that will convert the property of the given name
+    """return a MapperOption that will convert the property of the given name
     into an eager load."""
     return strategies.EagerLazyOption(name, lazy=False)
 
 def lazyload(name):
-    """returns a MapperOption that will convert the property of the given name
+    """return a MapperOption that will convert the property of the given name
     into a lazy load"""
     return strategies.EagerLazyOption(name, lazy=True)
 
index abca41ed63e5a34b02028269e9b9a8ca81010cf1..ed48d40cf15f4fc19c9b4cbe9675876b6b2e8568 100644 (file)
@@ -127,12 +127,15 @@ class StrategizedOption(MapperOption):
 class LoaderStrategy(object):
     """describes the loading behavior of a StrategizedProperty object.  The LoaderStrategy
     interacts with the querying process in three ways:
+    
       * it controls the configuration of the InstrumentedAttribute placed on a class to 
       handle the behavior of the attribute.  this may involve setting up class-level callable
       functions to fire off a select operation when the attribute is first accessed (i.e. a lazy load)
+
       * it processes the QueryContext at statement construction time, where it can modify the SQL statement
       that is being produced.  simple column attributes may add their represented column to the list of
       selected columns, "eager loading" properties may add LEFT OUTER JOIN clauses to the statement.
+
       * it processes the SelectionContext at row-processing time.  This may involve setting instance-level
       lazyloader functions on newly constructed instances, or may involve recursively appending child items 
       to a list in response to additionally eager-loaded objects in the query.
index cdfff2de6e29f03b16ea62b228d9ec187453056b..b60d9c03421a44e9fe1f33909dc6982dbe1eaf8d 100644 (file)
@@ -1188,15 +1188,6 @@ class SelectionContext(OperationContext):
         self.identity_map = {}
         super(SelectionContext, self).__init__(mapper, kwargs.pop('with_options', []), **kwargs)
 
-                
-class ExtensionOption(MapperOption):
-    """adds a new MapperExtension to a mapper's chain of extensions"""
-    def __init__(self, ext):
-        self.ext = ext
-    def process(self, mapper):
-        self.ext.next = mapper.extension
-        mapper.extension = self.ext
-
 class MapperExtension(object):
     """base implementation for an object that provides overriding behavior to various
     Mapper functions.  For each method in MapperExtension, a result of EXT_PASS indicates
@@ -1336,16 +1327,6 @@ class ClassKey(object):
     def __repr__(self):
         return "ClassKey(%s, %s)" % (repr(self.class_), repr(self.entity_name))
 
-def hash_key(obj):
-    if obj is None:
-        return 'None'
-    elif isinstance(obj, list):
-        return repr([hash_key(o) for o in obj])
-    elif hasattr(obj, 'hash_key'):
-        return obj.hash_key()
-    else:
-        return repr(obj)
-
 def has_identity(object):
     return hasattr(object, '_instance_key')