def getconn():
return MySQLdb.connect(user='ed', dbname='mydb')
- engine = create_engine('mysql', pool=pool.QueuePool(getconn, pool_size=20, max_overflow=40))
+ engine = create_engine('mysql://', pool=pool.QueuePool(getconn, pool_size=20, max_overflow=40))
* pool_size=5 : the number of connections to keep open inside the connection pool. This used with `QueuePool` as well as `SingletonThreadPool` as of 0.2.7.
* max_overflow=10 : the number of connections to allow in "overflow", that is connections that can be opened above and beyond the initial five. this is only used with `QueuePool`.
import session as sessionlib
import weakref
-__all__ = ['Mapper', 'MapperExtension', 'class_mapper', 'object_mapper', 'SynonymProperty', 'EXT_PASS']
+__all__ = ['Mapper', 'MapperExtension', 'class_mapper', 'object_mapper', 'EXT_PASS']
# a dictionary mapping classes to their primary mappers
mapper_registry = weakref.WeakKeyDictionary()
at the class level. otherwise we have to set attribute behavior on a per-instance level."""
return self.inherits is None and self.parent._is_primary_mapper()
-class SynonymProperty(MapperProperty):
- """a marker object used by query.select_by to allow a property name to refer to another.
-
- this object may be expanded in the future."""
- def __init__(self, name):
- self.name = name
- def execute(self, session, instance, row, identitykey, imap, isnew):
- pass
- def copy(self):
- return SynonymProperty(self.name)
-
class MapperOption(object):
"""describes a modification to a Mapper in the context of making a copy
of it. This is used to assist in the prototype pattern used by mapper.options()."""
seen.add(mapper_)
if mapper_.props.has_key(key):
prop = mapper_.props[key]
- if isinstance(prop, mapper.SynonymProperty):
- prop = mapper_.props[prop.name]
if isinstance(prop, properties.PropertyLoader):
keys.insert(0, prop.key)
return prop