I'm using SQLAlchemy 0.5.4p2 with Python 2.6.0.  So far all of my model
has been in the declarative style -

class Task(Base):
    """ An OpenGroupare Task object """
    __tablename__       = 'job'
    object_id           = Column("job_id",
                                Sequence('key_generator'),
                                primary_key=True)
    version             = Column("object_version", Integer)
    parent_id           = Column("parent_job_id", Integer,
                                 ForeignKey('job.job_id'),
                                 nullable=True)
....

But I have one 1:1 relation in my database that would be much easier to
model as just one object.

job_history                  job_history_info
---------------              ----------------------------
 job_history_id (PK) <-1:1-> job_history_id
 object_version              job_history_info_id (PK)
 job_id                      comment                   
 actor_id                    db_status
 action   
 action_date 
 job_status 
 db_status  

I've found at least one essay about doing this using the "traditional"
style of mapping @
<http://parijatmishra.wordpress.com/2009/01/18/sqlalchemy-one-classes-two-tables/>
  Is this possible using the declarative style?  If so are there any examples 
someone can point me to?

Is there, in general, a way to specify that a join is 1:1 so that the
mapper property returns the entity on the other side of the join rather
than a single element array?




--~--~---------~--~----~------------~-------~--~----~
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