I'm not sure if this is possible but this is my problem: We have 3
'user' tables that we're starting to centralize around a single
class.  mmf_user, auth_user, and mmf_user_profile where auth_user and
mmf_user are very similar but need to be maintained because of a bad
upgrade path decision a while ago.

Base = declarative_base()
class AuthUser(Base):
    __tablename__ = 'auth_user'
    #column definitions
    id = Column(u'id', Integer, ForeignKey('user.user_id'),
primary_key=True,
                nullable=False, autoincrement=True)
    auth_username = Column(u'username', String(50), nullable=False)
    auth_password = Column(u'password', String(50), nullable=False)
    is_staff = Column(u'is_staff', SmallInteger, nullable=False)
    is_active = Column(u'is_active', SmallInteger, nullable=False)
    is_superuser = Column(u'is_superuser', SmallInteger,
nullable=False)
    ..etc..

class MMFUser(Base):
    __tablename__ = 'mmf_user'
    #column definitions
    id = Column(u'user_id', Integer,primary_key=True,
                nullable=False, autoincrement=True)
    username = Column(u'username', String(50), nullable=False)
    password = Column(u'password', String(50), nullable=False)
    gender = Column(u'sex', String(1), nullable=False)
    .. etc..

class UserProfile(Base):
    __tablename__ = 'mmf_user_profile'
    #column definitions
    id = Column(u'user_id', Integer, ForeignKey('user.user_id'),
primary_key=True,
                nullable=False, autoincrement=True)
    profile = Column(u'profile', Text, nullable=False)
    ..etc..


1) How would I go about creating a super class of User() that
encompasses those 3 classes seamlessly

2) where User.username updates would update mmf_user.username as well
as auth_user.auth_username?

3) What about if mmf_user.username is the MD5() of the password while
auth_user.auth_password is a SHA1 salted version of it?

Is this even possible or should we continue to maintain the 3 classes
separately and when we solve this underlying architecture problem,
make the code changes through our system?

Thanks

-Kevin

-- 
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