Hi everybody, In my project, I would like to use a table setup similar to the following one:
users= Table('users', metadata, Column('id', Integer, primary_key=True), Column('name', String(50)), ... ) user_data = Table('user_data', metadata, Column('id', Integer, ForeignKey("contexts.id"), primary_key=True), Column('password', String(20)), ... ) It is a one to one-relationship, because each user only has one user_data column. It would be nice, if I could map this kind of relationship in a way similar to the one-to-one example of the documentation. So, in my corresponding User-object, I would like to be able to access the userData part like this, for example: user.userData.password But, when I map my one-to-one relation like this: UserData.mapper = mapper(UserData, user_data, properties = { 'id' : user_data.c.id, 'password' : user_data.c.password, } ) User.mapper = mapper(User, users, properties = { 'id' : users.c.id, 'name' : users.c.name, 'userData' : relation(UserData, cascade="all, delete-orphan") } ) then the mapper interpretes the relationship as one-to-many, thus mapping userData with a list like behaviour, for example: user.userData[0].password This is just a minor issue for me, but still... is there maybe an easy way to tell the mapper that it is a one-to-one relationship and not one-to-many? (I would like to avoid generating a separate primary key for my user_data (in contrast to the user_preferences example of the docs)) ... oh, and a second short question: is the SmallInteger column type broken? Thanks and cheers, Martin ______________________________________________________________ Verschicken Sie romantische, coole und witzige Bilder per SMS! Jetzt bei WEB.DE FreeMail: http://f.web.de/?mc=021193 ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Sqlalchemy-users mailing list Sqlalchemy-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users