Hello gentelmen and ladies,

I am very new to sqlalchemy and put in a position where I had to jump out of
and airplane and land on my head and walk on my hands to the end of this
project.

I wanted to know how one_to_man and many_to_many are carried out.

Here is an example

class Document(ActiveMapper):
    class mapping:
        __table__= 'document'
        id = column(Integer, primary_key=True)
        title = column(Unicode)
        shortdesc_dc = column(Unicode, nullable=True)

        doc_type_id = column(Integer, foreign_key=ForeignKey('doc_type.id'))
        layout_id = column(Integer, foreign_key=ForeignKey('layout.id'))
        body_id = column(Integer, foreign_key=ForeignKey('body.id'))

        dochists = one_to_many('DocumentHistory', colname='doc_id',
backref='document')
        doctags = many_to_many('DocTag', document_doc_tag_table,
backref='document')



Does this mean that there is one document to many DocumentHistory. If so
that is what I need

And below is the DocumentHistory section


class DocumentHistory(ActiveMapper):
    class mapping:
        __table__= 'document_hist'
        id = column(Integer, primary_key=True)
        user_guid = column(Integer, nullable=True)
        timestamp = column(TIMESTAMP, nullable=False)
        rev_num = column(Integer, nullable=True)
        change = column(Unicode, nullable=True)

        doc_id = column(CHAR(32), foreign_key=ForeignKey('document.id'))


Thanks for your help. Some day I will repay the group with my knowlege.

Wes Duff

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to