views:

28

answers:

0

Hello,

I got this error when I've tried to relate some classes:

"UnmappedClassError: Class 'zeppelinlib.user.UserTest.User' is not mapped"

I don't get errors when I have relation many-to-many.

This is my file where I store all the User classes.

user_channels = Table(
            "user_channels",
            metadata,
            Column("user_id", Integer, ForeignKey("users.id")),
            Column("channel_id", Integer, ForeignKey(Channel.id))
        )

group_permissions = Table(
                "group_permissions",
                metadata,
                Column("group_id", Integer, ForeignKey("user_groups.id")),
                Column("permission_id", Integer, ForeignKey(Permission.id))
            )

class User(rdb.Model):
    """Represents the user"""
    rdb.metadata(metadata)
    rdb.tablename("users")

    id = Column("id", Integer, primary_key=True)
    name = Column("name", String(50))
    email = Column("email", String(50))
group_id = Column("group_id", Integer, ForeignKey("user_groups.id"))


    channels = relation(Channel, secondary=user_channels, backref="channels")



class UserGroup(rdb.Model):
    """Represents a group of users with the same features"""
    rdb.metadata(metadata)
    rdb.tablename("user_groups")

    id = Column("id", Integer, primary_key=True)
    title = Column("title", String(50))

    users = relation(User, backref="users")
    permissions = relation(Permission, secondary=group_permissions, backref="permissions")

How can I solve it?

Thanks in advance!