On Jun 4, 2010, at 1:16 PM, Gunnlaugur Briem wrote:

> Hi,
> 
> I'm finally adapting our codebase to SqlAlchemy 0.6, and I've found a
> couple of breaking changes that are not documented in
> http://www.sqlalchemy.org/trac/wiki/06Migration
> 
> First, ResultProxy.keys is now a method returning a list, not a list-
> valued attribute, so expressions like k in result.keys or
> result.keys.index no longer work; the keys references must be changed
> to method invocations.
> 
> Second, DeclarativeMeta.__init__ now ignores columns defined in the
> dict_ passed to it (by a subclass metaclass constructor), using
> cls.__dict__ instead. This seems to be deliberate, the log message on
> commit 6055 is “DeclarativeMeta exclusively uses cls.__dict__ (not
> dict_)”. But it breaks my use case; we have subclassed the metaclass
> to add two columns that are common to a set of entities of ours:
> 
> class DimensionValueMeta(DeclarativeMeta):
>    def __init__(cls, classname, bases, dict_):
>        if not dict_.has_key('__table__'):
>            dict_['id'] = Column(Integer, primary_key=True)
>            dict_['value'] = Column(UnicodeText, nullable=False,
> unique=True)
>        DeclarativeMeta.__init__(cls, classname, bases, dict_)
> 
> I am told that just assigning cls.id = Column(...) and cls.value =
> Column(...) will work, which is cleaner anyway.
> 
> I've added draft explanations of these two breaking changes to
> http://www.sqlalchemy.org/trac/wiki/06Migration (last two changes by
> “guest”) — please review and fix whatever I got wrong.

the keys() thing surprises me but I haven't checked.  otherwise seems fine, 
thanks !



-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to