Hi,
I have a problema to make updates on tables with Association Objects
class Type(PrimaryKey, Base):
__tablename__ = "types"
name = Column(Unicode, nullable=False)
description = Column(Unicode)
users = relationship(User, secondary="type_users")
class TypeUser(Base):
__tablename__ = "type_users"
type_id = Column(Integer, ForeignKey("types.pk"), primary_key=True)
user_id = Column(Integer, ForeignKey("users.pk"), primary_key=True)
type = relationship(Type, backref=backref("type_users", lazy="dynamic"))
user = relationship(User, backref=backref("type", uselist=False))
class User(PrimaryKey, Base):
__tablename__ = "users"
# some irrelevant datas.
To save is easy...
user = User.query.get(pk)
type = Type.query.get(other_pk)
type.users.append(user)
How I can update o `type` of user??
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.