]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
introductory docstring bonanza
authorMike Bayer <mike_mp@zzzcomputing.com>
Tue, 18 Dec 2007 23:53:40 +0000 (23:53 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Tue, 18 Dec 2007 23:53:40 +0000 (23:53 +0000)
18 files changed:
doc/build/gen_docstrings.py
doc/build/templates/pydoc.html
lib/sqlalchemy/engine/base.py
lib/sqlalchemy/engine/default.py
lib/sqlalchemy/engine/strategies.py
lib/sqlalchemy/engine/threadlocal.py
lib/sqlalchemy/engine/url.py
lib/sqlalchemy/exceptions.py
lib/sqlalchemy/orm/__init__.py
lib/sqlalchemy/orm/interfaces.py
lib/sqlalchemy/orm/mapper.py
lib/sqlalchemy/orm/properties.py
lib/sqlalchemy/orm/query.py
lib/sqlalchemy/orm/session.py
lib/sqlalchemy/orm/shard.py
lib/sqlalchemy/schema.py
lib/sqlalchemy/sql/compiler.py
lib/sqlalchemy/types.py

index 1931e08918070ec3b68e47e8dc0e0cbc2f2354e0..d7c6b210f1f9fa6472279b544876276f32245e6b 100644 (file)
@@ -4,7 +4,7 @@ import re
 
 from sqlalchemy import schema, types, engine, sql, pool, orm, exceptions, databases, interfaces
 from sqlalchemy.sql import compiler, expression
-from sqlalchemy.engine import default, strategies, threadlocal
+from sqlalchemy.engine import default, strategies, threadlocal, url
 import sqlalchemy.orm.shard
 import sqlalchemy.ext.sessioncontext as sessioncontext
 import sqlalchemy.ext.selectresults as selectresults
@@ -24,16 +24,16 @@ def make_all_docs():
     objects = [
         make_doc(obj=engine),
         make_doc(obj=default),
-        make_doc(obj=engine.url),
+        make_doc(obj=strategies),
         make_doc(obj=threadlocal),
+        make_doc(obj=url),
         make_doc(obj=exceptions),
+        make_doc(obj=interfaces),
+        make_doc(obj=pool),
         make_doc(obj=schema),
         #make_doc(obj=sql,include_all_classes=True),
         make_doc(obj=compiler),
         make_doc(obj=expression,include_all_classes=True),
-        make_doc(obj=interfaces),
-        make_doc(obj=pool),
-        make_doc(obj=strategies),
         make_doc(obj=types),
         make_doc(obj=orm),
         make_doc(obj=orm.collections, classes=[orm.collections.collection,
index 34bb5e7bc34933490c8f16b4a3e760245219c0af..a4f4caf141ea3b4f5d63ec66224f9a2b5f657077 100644 (file)
@@ -37,12 +37,14 @@ def formatdocstring(content):
 <%def name="inline_links(toc, extension, paged)"><%
     def link(match):
         (module, desc) = match.group(1,2)
-        if desc.endswith('()'):
+        if not desc:
+            path = "docstrings_" + module
+        elif desc.endswith('()'):
             path = "docstrings_" + module + "_modfunc_" + desc[:-2]
         else:
             path = "docstrings_" + module + "_" + desc
-        return capture(nav.toclink, toc=toc, path=path, description=desc, extension=extension, paged=paged)
-    return lambda content: re.sub(r'\[(.+?)#(.+?)?\]', link, content)
+        return capture(nav.toclink, toc=toc, path=path, description=desc or None, extension=extension, paged=paged)
+    return lambda content: re.sub('\[(.+?)#(.*?)\]', link, content)
 %></%def>
 
 <%namespace name="formatting" file="formatting.html"/>
index 783d60cf446de58d39f408e29ba5d26ca8988e8a..ff2245f39e69aefb5544aacf7e6ae3d06e41d38a 100644 (file)
@@ -5,7 +5,7 @@
 # the MIT License: http://www.opensource.org/licenses/mit-license.php
 
 
-"""Basic components for SQL execution and interfacing with DB-API..
+"""Basic components for SQL execution and interfacing with DB-API.
 
 Defines the basic components used to interface DB-API modules with
 higher-level statement-construction, connection-management, execution
index 38ea903e439e90e437df955f157f9ee461083715..b06f862f7e86ae83ab35bd7d4816b2193090a966 100644 (file)
@@ -4,7 +4,13 @@
 # This module is part of SQLAlchemy and is released under
 # the MIT License: http://www.opensource.org/licenses/mit-license.php
 
-"""Default implementations of per-dialect sqlalchemy.engine classes."""
+"""Default implementations of per-dialect sqlalchemy.engine classes.
+
+These are semi-private implementation classes which are only of importance
+to database dialect authors; dialects will usually use the classes here
+as the base class for their own corresponding classes.
+
+"""
 
 
 import re, random
index 175846ff8a7462a48750b0028eaf55da95efdbac..d4a0ad841881d4af47ba06c257a6fccf8a1a7fad 100644 (file)
@@ -1,10 +1,13 @@
 """Strategies for creating new instances of Engine types.
 
-By default there are two, one which is the "thread-local" strategy,
-one which is the "plain" strategy.
-
-New strategies can be added via constructing a new EngineStrategy
-object which will add itself to the list of available strategies.
+These are semi-private implementation classes which 
+provide the underlying behavior for the "strategy" keyword argument 
+available on [sqlalchemy.engine#create_engine()].
+Current available options are ``plain``, ``threadlocal``, and
+``mock``.
+
+New strategies can be added via new ``EngineStrategy``
+classes.
 """
 
 
index 6122b61b239dd0b2fb8a38cbfe9b0cb7279976ba..d07d8da835ba16b58761ce55940aa6078e6bf5c6 100644 (file)
@@ -1,12 +1,13 @@
-from sqlalchemy import util
-from sqlalchemy.engine import base
-
 """Provides a thread-local transactional wrapper around the root Engine class.
 
-Provides begin/commit methods on the engine itself which correspond to
-a thread-local transaction.
+The ``threadlocal`` module is invoked when using the ``strategy="threadlocal"`` flag
+with [sqlalchemy.engine#create_engine()].  This module is semi-private and is 
+invoked automatically when the threadlocal engine strategy is used.
 """
 
+from sqlalchemy import util
+from sqlalchemy.engine import base
+
 class TLSession(object):
     def __init__(self, engine):
         self.engine = engine
index a3487638c28ad65679f8d0b80546308959fe5aa1..663819f052e740110bb9a56e47cd6a23ae76f52c 100644 (file)
@@ -1,4 +1,10 @@
-"""Provides URL facilities for specifying database connections."""
+"""Provides the [sqlalchemy.engine.url#URL] class which encapsulates
+information about a database connection specification.
+
+The URL object is created automatically when [sqlalchemy.engine#create_engine()] is called
+with a string argument; alternatively, the URL is a public-facing construct which can
+be used directly and is also accepted directly by ``create_engine()``.
+"""
 
 import re, cgi, sys, urllib
 from sqlalchemy import exceptions
index dd0f89737fefc462f5dd26d6808c2455c3735729..8338bc554f7e2ffe69f8d8cb5d9486abd0ff0aeb 100644 (file)
@@ -3,7 +3,10 @@
 #
 # This module is part of SQLAlchemy and is released under
 # the MIT License: http://www.opensource.org/licenses/mit-license.php
+"""Exceptions used with SQLAlchemy.
 
+The base exception class is SQLAlchemyError.  Exceptions which are raised as a result
+of DBAPI exceptions are all subclasses of [sqlalchemy.exceptions#DBAPIError]."""
 
 class SQLAlchemyError(Exception):
     """Generic error class."""
index 7e8d8b8bf852a3dabda0ecc16960b6c7f75d3ed7..8bff42d2c40b7c8baa4946e6ff3bea6fc580ed79 100644 (file)
@@ -5,9 +5,10 @@
 # the MIT License: http://www.opensource.org/licenses/mit-license.php
 
 """
-The mapper package provides object-relational functionality, building upon
-the schema and sql packages and tying operations to class properties and
-constructors.
+Functional constructs for ORM configuration.
+
+See the SQLAlchemy object relational tutorial and mapper configuration 
+documentation for an overview of how this module is used.
 """
 
 from sqlalchemy import util as sautil
index 6119d1c6e6adfbbeefb5676fa4c96b2237e32a92..52e39372d8e0e21c4afb3832888c4a699bbb0b99 100644 (file)
@@ -4,7 +4,15 @@
 # This module is part of SQLAlchemy and is released under
 # the MIT License: http://www.opensource.org/licenses/mit-license.php
 
+"""Semi-private implementation objects which form the basis
+of ORM-mapped attributes, query options and mapper extension.
 
+Defines the [sqlalchemy.orm.interfaces#MapperExtension] class,
+which can be end-user subclassed to add event-based functionality
+to mappers.  The remainder of this module is generally private to the
+ORM.
+
+"""
 from sqlalchemy import util, logging, exceptions
 from sqlalchemy.sql import expression
 class_mapper = None
index 95d118ee406676fd198643e8931067bf8ff9763d..2c3d3ea40614d305bb1f68a43b0ca79c1c32a6a1 100644 (file)
@@ -4,6 +4,13 @@
 # This module is part of SQLAlchemy and is released under
 # the MIT License: http://www.opensource.org/licenses/mit-license.php
 
+"""Defines the [sqlalchemy.orm.mapper#Mapper] class, the central configurational
+unit which associates a class with a database table.
+
+This is a semi-private module; the main configurational API of the ORM is 
+avaiable in [sqlalchemy.orm#].
+"""
+
 import weakref, warnings
 from itertools import chain
 from sqlalchemy import sql, util, exceptions, logging
@@ -37,7 +44,7 @@ class Mapper(object):
     columns.
 
     Instances of this class should be constructed via the
-    ``sqlalchemy.orm.mapper()`` function.
+    [sqlalchemy.orm#mapper()] function.
     """
 
     def __init__(self,
index 441a1d7cd62343e5f445e0225539560396214da6..aadac5122c163140160d5d4287fc2ca8f28cfcfb 100644 (file)
@@ -4,11 +4,10 @@
 # This module is part of SQLAlchemy and is released under
 # the MIT License: http://www.opensource.org/licenses/mit-license.php
 
-"""Defines a set of mapper.MapperProperty objects, including basic
-column properties as well as relationships.  The objects rely upon the
-LoaderStrategy objects in the strategies.py module to handle load
-operations.  PropertyLoader also relies upon the dependency.py module
-to handle flush-time dependency sorting and processing.
+"""MapperProperty implementations.  
+
+This is a private module which defines the behavior of
+invidual ORM-mapped attributes.
 """
 
 from sqlalchemy import sql, schema, util, exceptions, logging
index 2c9a1d0ff52f2f921d4dd4c454cdfd75194c73bd..0d7f76dcad9e8f716f81ea41bccd2826a5e59049 100644 (file)
@@ -4,6 +4,17 @@
 # This module is part of SQLAlchemy and is released under
 # the MIT License: http://www.opensource.org/licenses/mit-license.php
 
+"""Defines the [sqlalchemy.orm.query#Query] class, the central
+construct used by the ORM to construct database queries.
+
+The ``Query`` class should not be confused with the [sqlalchemy.sql.expression#Select]
+class, which defines database SELECT operations at the SQL (non-ORM) level.
+``Query`` differs from ``Select`` in that it returns ORM-mapped objects and interacts
+with an ORM session, whereas the ``Select`` construct interacts directly with the database
+to return iterable result sets.
+"""
+
+
 from sqlalchemy import sql, util, exceptions, logging
 from sqlalchemy.sql import util as sql_util
 from sqlalchemy.sql import expression, visitors, operators
index 541590b82d81c05db3bc17f682d0e7659429f08e..993eba4c5feeb868c2d256f5888120eeac1d2c98 100644 (file)
@@ -4,6 +4,9 @@
 # This module is part of SQLAlchemy and is released under
 # the MIT License: http://www.opensource.org/licenses/mit-license.php
 
+"""Provides the Session class and related utilities."""
+
+
 import weakref
 from sqlalchemy import util, exceptions, sql, engine
 from sqlalchemy.orm import unitofwork, query, attributes, util as mapperutil
@@ -320,6 +323,9 @@ class Session(object):
 
     def __init__(self, bind=None, autoflush=True, transactional=False, twophase=False, echo_uow=False, weak_identity_map=True, binds=None, extension=None):
         """Construct a new Session.
+        
+        A session is usually constructed using the [sqlalchemy.orm#create_session()] function, 
+        or its more "automated" variant [sqlalchemy.orm#sessionmaker()].
 
         autoflush
             When ``True``, all query operations will issue a ``flush()`` call to this
index 5036bc1154bffb0434fe7e7715c0c4d1e77301bd..7cf4eb2cc50af682bcb44b67a6c875b3fc82f8d3 100644 (file)
@@ -1,3 +1,10 @@
+"""Defines a rudimental 'horizontal sharding' system which allows a 
+Session to distribute queries and persistence operations across multiple 
+databases.
+
+For a usage example, see the example ``examples/sharding/attribute_shard.py``.
+
+"""
 from sqlalchemy.orm.session import Session
 from sqlalchemy.orm.query import Query
 from sqlalchemy import exceptions, util
index 301acdc2b653912f3967ce38f788bafefea25aba..dd925a508d1822ee1c79279158e2eb48367629dd 100644 (file)
@@ -6,15 +6,23 @@
 
 """The schema module provides the building blocks for database metadata.
 
-This means all the entities within a SQL database that we might want
-to look at, modify, or create and delete are described by these
-objects, in a database-agnostic way.
-
-A structure of SchemaItems also provides a *visitor* interface which is
-the primary method by which other methods operate upon the schema.
-The SQL package extends this structure with its own clause-specific
-objects as well as the visitor interface, so that the schema package
-*plugs in* to the SQL package.
+Each element within this module describes a database entity 
+which can be created and dropped, or is otherwise part of such an entity.
+Examples include tables, columns, sequences, and indexes.
+
+All entities are subclasses of [sqlalchemy.schema#SchemaItem], and as 
+defined in this module they are intended to be agnostic of any 
+vendor-specific constructs.
+
+A collection of entities are grouped into a unit called [sqlalchemy.schema#MetaData].
+MetaData serves as a logical grouping of schema elements, and can also
+be associated with an actual database connection such that operations 
+involving the contained elements can contact the database as needed.
+
+Two of the elements here also build upon their "syntactic" counterparts,
+which are defined in [sqlalchemy.sql.expression#], specifically [sqlalchemy.schema#Table]
+and [sqlalchemy.schema#Column].  Since these objects are part of the
+SQL expression language, they are usable as components in SQL expressions.
 """
 
 import re, inspect
index 2472853847a3126777978b462ee4c1193d950135..bdcd94688b8709096e5481f2f4fe88152d281da5 100644 (file)
@@ -4,7 +4,19 @@
 # This module is part of SQLAlchemy and is released under
 # the MIT License: http://www.opensource.org/licenses/mit-license.php
 
-"""SQL expression compilation routines and DDL implementations."""
+"""Base SQL and DDL compiler implementations.
+
+Provides the [sqlalchemy.sql.compiler#DefaultCompiler] class, which is
+responsible for generating all SQL query strings, as well as 
+[sqlalchemy.sql.compiler#SchemaGenerator] and [sqlalchemy.sql.compiler#SchemaDropper]
+which issue CREATE and DROP DDL for tables, sequences, and indexes.
+
+The elements in this module are used by public-facing constructs like
+[sqlalchemy.sql.expression#ClauseElement] and [sqlalchemy.engine#Engine].
+While dialect authors will want to be familiar with this module for the purpose of
+creating database-specific compilers and schema generators, the module 
+is otherwise internal to SQLAlchemy.
+"""
 
 import string, re
 from sqlalchemy import schema, engine, util, exceptions
index 44e6ebf60decaeec5afa9ec5ab423239a6210222..83e388c4f32d447b14077c07220cb3a34a1e5707 100644 (file)
@@ -4,7 +4,14 @@
 # This module is part of SQLAlchemy and is released under
 # the MIT License: http://www.opensource.org/licenses/mit-license.php
 
-__all__ = [ 'TypeEngine', 'TypeDecorator',
+"""defines genericized SQL types, each represented by a subclass of 
+[sqlalchemy.types#AbstractType].  Dialects define further subclasses of these 
+types.
+
+For more information see the SQLAlchemy documentation on types.
+
+"""
+__all__ = [ 'TypeEngine', 'TypeDecorator', 'AbstractType',
             'INT', 'CHAR', 'VARCHAR', 'NCHAR', 'TEXT', 'FLOAT',
             'NUMERIC', 'DECIMAL', 'TIMESTAMP', 'DATETIME', 'CLOB', 'BLOB',
             'BOOLEAN', 'SMALLINT', 'DATE', 'TIME',