]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
various cleanup, docs and things, getting ready for 0.3.6
authorMike Bayer <mike_mp@zzzcomputing.com>
Fri, 23 Mar 2007 21:33:24 +0000 (21:33 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Fri, 23 Mar 2007 21:33:24 +0000 (21:33 +0000)
CHANGES
doc/build/content/dbengine.txt
lib/sqlalchemy/databases/postgres.py
lib/sqlalchemy/orm/interfaces.py
setup.py

diff --git a/CHANGES b/CHANGES
index a567b71b7dec726ddf510fa7c476657777e8a523..4a958c2521a342572bfcbdc7a3911670d236e0a8 100644 (file)
--- a/CHANGES
+++ b/CHANGES
     - cleanup of module importing code; specifiable DB-API module; more 
       explicit ordering of module preferences. [ticket:480]
 
-
-
     
 0.3.5
 - sql:
index ae818ec03b2a6ad2054724799a26f40dd1e8fbcf..c04d6a6bbed74d73ade89c5b7ebf27c23f76e7cb 100644 (file)
@@ -58,7 +58,7 @@ Available drivernames are `sqlite`, `mysql`, `postgres`, `oracle`, `mssql`, and
     # oracle will feed host/port/SID into cx_oracle.makedsn
     oracle_db = create_engine('oracle://scott:tiger@127.0.0.1:1521/sidname')
 
-The `Engine` will create its first connection to the database when a SQL statement is executed.  As concurrent statements are executed, the underlying connection pool will grow to a default size of five connections, and will allow a default "overflow" of ten.   Since the `Engine` is essentially "home base" for the connection pool, it follows that you should keep a single `Engine` per database established within an application, rather than creating a new one for each connection.
+The `Engine` will ask the connection pool for a connection when a SQL statement is executed.  The default connection pool, `QueuePool` as well as the default SQLite connection pool `SingletonThreadPool`, will open connections to the database on an as-needed basis.  As concurrent statements are executed, `QueuePool` will grow its pool of connections to a default size of five, and will allow a default "overflow" of ten.   Since the `Engine` is essentially "home base" for the connection pool, it follows that you should keep a single `Engine` per database established within an application, rather than creating a new one for each connection.
 
 #### Custom DBAPI keyword arguments
 
@@ -87,30 +87,19 @@ The most customizable connection method of all is to pass a `creator` argument,
 Keyword options can also be specified to `create_engine()`, following the string URL as follows:
 
     {python}
-    db = create_engine('postgres://...', encoding='latin1', echo=True, module=psycopg1)
+    db = create_engine('postgres://...', encoding='latin1', echo=True)
 
 A list of all standard options, as well as several that are used by particular database dialects, is as follows:
 
+* **connect_args** - a dictionary of options which will be passed directly to the DBAPI's `connect()` method as additional keyword arguments.
 * **convert_unicode=False** - if set to True, all String/character based types will convert Unicode values to raw byte values going into the database, and all raw byte values to Python Unicode coming out in result sets.  This is an engine-wide method to provide unicode conversion across the board.  For unicode conversion on a column-by-column level, use the `Unicode` column type instead, described in [types](rel:types).
+* **creator** - a callable which returns a DBAPI connection.  This creation function will be passed to the underlying connection pool and will be used to create all new database connections.  Usage of this function causes connection parameters specified in the URL argument to be bypassed.
 * **echo=False** - if True, the Engine will log all statements as well as a repr() of their parameter lists to the engines logger, which defaults to sys.stdout.  The `echo` attribute of `Engine` can be modified at any time to turn logging on and off.  If set to the string `"debug"`, result rows will be printed to the standard output as well.  This flag ultimately controls a Python logger; see [dbengine_logging](rel:dbengine_logging) for information on how to configure logging directly.
 * **echo_pool=False** - if True, the connection pool will log all checkouts/checkins to the logging stream, which defaults to sys.stdout.  This flag ultimately controls a Python logger; see [dbengine_logging](rel:dbengine_logging) for information on how to configure logging directly.
 * **encoding='utf-8'** - the encoding to use for all Unicode translations, both by engine-wide unicode conversion as well as the `Unicode` type object.
 * **module=None** - used by database implementations which support multiple DBAPI modules, this is a reference to a DBAPI2 module to be used instead of the engine's default module.  For Postgres, the default is psycopg2, or psycopg1 if 2 cannot be found.  For Oracle, its cx_Oracle.
-* **pool=None** - an actual pool instance.  Note that an already-constructed pool should already know how to create database connections, so this option supercedes any other connect options specified.  Typically, it is an instance of `sqlalchemy.pool.Pool` to be used as the underlying source for connections.  For more on connection pooling, see [pooling](rel:pooling).
-
-Example of a manual invocation of `pool.QueuePool` (which is the pool instance used for all databases except sqlite):
-
-    {python}
-    from sqlalchemy import *
-    import sqlalchemy.pool as pool
-    import MySQLdb
-    
-    def getconn():
-        return MySQLdb.connect(user='ed', dbname='mydb')
-    
-    engine = create_engine('mysql://', pool=pool.QueuePool(getconn, pool_size=20, max_overflow=40))
-
-* **poolclass=None** - a `sqlalchemy.pool.Pool` subclass that will be instantated in place of the default connection pool.
+* **pool=None** - an already-constructed instance of `sqlalchemy.pool.Pool`, such as a `QueuePool` instance.  If non-None, this pool will be used directly as the underlying connection pool for the engine, bypassing whatever connection parameters are present in the URL argument.  For information on constructing connection pools manually, see [pooling](rel:pooling).
+* **poolclass=None** - a `sqlalchemy.pool.Pool` subclass, which will be used to create a connection pool instance using the connection parameters given in the URL.  Note this differs from `pool` in that you don't actually instantiate the pool in this case, you just indicate what type of pool to be used.
 * **max_overflow=10** - the number of connections to allow in connection pool "overflow", that is connections that can be opened above and beyond the pool_size setting, which defaults to five.  this is only used with `QueuePool`.
 * **pool_size=5** - the number of connections to keep open inside the connection pool.  This used with `QueuePool` as well as `SingletonThreadPool`.
 * **pool_recycle=-1** - this setting causes the pool to recycle connections after the given number of seconds has passed.  It defaults to -1, or no timeout.  For example, setting to 3600 means connections will be recycled after one hour.  Note that MySQL in particular will disconnect automatically if no activity is detected on a connection for eight hours (although this is configurable with the MySQLDB connection itself and the  server configuration as well).
index 20686f9ea2a7ec37441499f4552210f68c44dd6d..93f20889c57678a14d81131981d3b7885e8da177 100644 (file)
@@ -487,7 +487,7 @@ class PGDialect(ansisql.ANSIDialect):
                     for column in referred_columns:
                         refspec.append(".".join([referred_table, column]))
 
-                table.append_constraint(ForeignKeyConstraint(constrained_columns, refspec, conname))
+                table.append_constraint(schema.ForeignKeyConstraint(constrained_columns, refspec, conname))
 
 class PGCompiler(ansisql.ANSICompiler):
     def visit_insert_column(self, column, parameters):
index 91f58e833eee10be50f316af17cbe2d0b37b6669..5c6a92325e47ea1ef85da8d88994ebcc03a75bf5 100644 (file)
@@ -187,7 +187,7 @@ class OperationContext(object):
         pass
 
 class MapperOption(object):
-    """Describe a modification to an OperationContext."""
+    """Describe a modification to an OperationContext or Query."""
 
     def process_query_context(self, context):
         pass
index f0a588501d28f6fe92f344a4f8815927a9664934..b859a53cecdcb2609e3bdeaea7f30891cd70f3cb 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -3,7 +3,7 @@ use_setuptools()
 from setuptools import setup, find_packages
 
 setup(name = "SQLAlchemy",
-    version = "0.3.5",
+    version = "0.3.6",
     description = "Database Abstraction Library",
     author = "Mike Bayer",
     author_email = "mike_mp@zzzcomputing.com",
@@ -15,7 +15,7 @@ setup(name = "SQLAlchemy",
 SQLAlchemy is:
 
     * The Python SQL toolkit and Object Relational Mapper that gives application developers the full power and flexibility of SQL. SQLAlchemy provides a full suite of well known enterprise-level persistence patterns, designed for efficient and high-performing database access, adapted into a simple and Pythonic domain language.
-    * extremely easy to use for all the basic tasks, such as: accessing thread-safe and pooled connections, constructing SQL from Python expressions, finding object instances, and commiting object modifications back to the database.
+    * extremely easy to use for all the basic tasks, such as: accessing pooled connections, constructing SQL from Python expressions, finding object instances, and commiting object modifications back to the database.
     * powerful enough for complicated tasks, such as: eager load a graph of objects and their dependencies via joins; map recursive adjacency structures automatically; map objects to not just tables but to any arbitrary join or select statement; combine multiple tables together to load whole sets of otherwise unrelated objects from a single result set; commit entire graphs of object changes in one step.
     * built to conform to what DBAs demand, including the ability to swap out generated SQL with hand-optimized statements, full usage of bind parameters for all literal values, fully transactionalized and consistent updates using Unit of Work.
     * modular. Different parts of SQLAlchemy can be used independently of the rest, including the connection pool, SQL construction, and ORM. SQLAlchemy is constructed in an open style that allows plenty of customization, with an architecture that supports custom datatypes, custom SQL extensions, and ORM plugins which can augment or extend mapping functionality.