need autoflush w pre-attached object.
[ticket:2464]
+ - [feature] The registry of classes
+ in declarative_base() is now a
+ WeakValueDictionary. So subclasses of
+ "Base" that are dereferenced will be
+ garbage collected, *if they are not
+ referred to by any other mappers/superclass
+ mappers*. [ticket:2526]
+
- [removed] Deprecated identifiers removed:
* allow_null_pks mapper() argument
from sqlalchemy.sql import util as sql_util, expression
from sqlalchemy import event
from sqlalchemy.orm.util import polymorphic_union, _mapper_or_none
-
+import weakref
__all__ = 'declarative_base', 'synonym_for', \
'comparable_using', 'instrument_declarative'
lcl_metadata.bind = bind
if class_registry is None:
- class_registry = {}
+ class_registry = weakref.WeakValueDictionary()
bases = not isinstance(cls, tuple) and (cls,) or cls
class_dict = dict(_decl_class_registry=class_registry,