Chris Withers wrote:
> Hi All,
>
> Is this the right way to do this:
>
> class Blog(Base):
>      __tablename__='blog_entry'
>      id = Column(Integer, primary_key=True)
>      date =  Column('dated', Date, nullable=False)
>      title =  Column(String(80))
>      entry =  Column(Text())
>
>      owners_name = Column(ForeignKey('person.name'))
>      owner = relation('Person', back_populates="blogs")
>
>
> class Person(Base):
>      __tablename__='person'
>      name =  Column(String(80), primary_key=True)
>
>      blogs = relation('Blog', back_populates="owner")
>
> ...or is there something subtle that's going to come back and bite me?
>
> The aim is to make it explicit when looking at one model what its
> attributes are, rather than having to guess what other models (which are
> often in other files, far from the reader's eye) have placed backrefs on
> it?

that's the point of it, yup...enjoy the feature



>
> cheers,
>
> Chris
>
> --
> You received this message because you are subscribed to the Google Groups
> "sqlalchemy" group.
> To post to this group, send email to sqlalch...@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.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalch...@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