summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy
diff options
context:
space:
mode:
authorJason Kirtland <jek@discorporate.us>2007-08-29 23:17:36 +0000
committerJason Kirtland <jek@discorporate.us>2007-08-29 23:17:36 +0000
commit3d9d21cc14982654cadd7678d44e14df62d812d2 (patch)
treefeb1d7667d322b80828c6766802f90547fb48774 /lib/sqlalchemy
parent83d05aa5aff0b27027fb10986390d898a3153eb2 (diff)
downloadsqlalchemy-3d9d21cc14982654cadd7678d44e14df62d812d2.tar.gz
Extended 'engine_from_config' coercion for QueuePool size / overflow. [ticket:763]
Added a set of coercion tests.
Diffstat (limited to 'lib/sqlalchemy')
-rw-r--r--lib/sqlalchemy/engine/__init__.py25
1 files changed, 17 insertions, 8 deletions
diff --git a/lib/sqlalchemy/engine/__init__.py b/lib/sqlalchemy/engine/__init__.py
index ae32b40bb..1c1107d3d 100644
--- a/lib/sqlalchemy/engine/__init__.py
+++ b/lib/sqlalchemy/engine/__init__.py
@@ -166,21 +166,30 @@ def engine_from_config(configuration, prefix='sqlalchemy.', **kwargs):
'prefix' argument indicates the prefix to be searched for.
A select set of keyword arguments will be "coerced" to their
- expected type based on string values. in a future release, this
- functionality will be expanded to include dialect-specific
+ expected type based on string values. In a future release, this
+ functionality will be expanded and include dialect-specific
arguments.
"""
- opts = dict([(key[len(prefix):], configuration[key])
+ opts = _coerce_config(configuration, prefix)
+ opts.update(kwargs)
+ url = opts.pop('url')
+ return create_engine(url, **opts)
+
+def _coerce_config(configuration, prefix):
+ """Convert configuration values to expected types."""
+
+ options = dict([(key[len(prefix):], configuration[key])
for key in configuration if key.startswith(prefix)])
- for opt, type_ in (
+ for option, type_ in (
('convert_unicode', bool),
('pool_timeout', int),
('echo', bool),
('echo_pool', bool),
('pool_recycle', int),
+ ('pool_size', int),
+ ('max_overflow', int),
+ ('pool_threadlocal', bool),
):
- util.coerce_kw_type(opts, opt, type_)
- opts.update(kwargs)
- url = opts.pop('url')
- return create_engine(url, **opts)
+ util.coerce_kw_type(options, option, type_)
+ return options