Hi,
I created two classes "Resource" and "BaseMedia", and "BaseMedia" is a
subclass of "Resource". The table mapping is implemented as below:

class Resource(Database.Base):
        __tablename__ = "resources"
        createUserId = Column("create_user_id", Integer,
ForeignKey("users.id"), nullable=True, key="createUserId",
default=currentUserId)
        modifyUserId = Column("modify_user_id", Integer,
ForeignKey("users.id"), nullable=True, key="modifyUserId",
default=currentUserId, onupdate=currentUserId)

class BaseMedia(Resource.Resource):
        __tablename__ = "base_media"
        id = Column("id", Integer, ForeignKey("resources.id"),
primary_key=True)
        __mapper_args__ = { 'extension':
BaseMediaMapperExtension.BaseMediaMapperExtension() }
        name = Column("name", Unicode(50))
        type = Column("type", String(50))
        size = Column("size", Integer)

and then, when I try to use session.add() to insert a new BaseMedia
object, the parameter "default=currentUserId" in both "createUserId"
and "modifyUserId" columns is working properly. However, if I use
session.merge() to update the "name" column in an existing BaseMedia
object, the "name" field is updated correctly in the database, but the
parameter "onupdate=currentUserId" is not firing, and therefore I
couldn't update the "modifyUserId" field with this "onupdate"
parameter.

The code is running with sqlalchemy 0.6.4, and there isn't any warning
or error message from it. I will appreciate if anyone can help me
solve this problem.

Wubin

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

Reply via email to