Gaetan,

Thanks for the reply.  Perhaps with more study, I'll be able to apply
that information to what I'm doing.

Unfortunately, I keep running into more and more situations that seem
to be difficult to handle, or at least, to understand how to handle,
using Elixir and SQLAlchemy.  Let me give you an example of the
latest.

In my application, I need to handle a lot of information about a
person, and so I quickly realized I needed a Person class/table to
hold it.  Now, a Person can serve many roles, and so in addition to
the Person class/table, I have for example, a Patient class/table and
a Guarantor class/table.  A Person can be both a Patient and a
Guarantor.  When I first started out, I set up a simple many-to-one
relationship between Person and Patient or Guarantor.  This meant that
there was a patient_id field and a guarantor_id field in the Person
class/table.  As I added more roles that a Person could serve as, it
became apparent I was going about this in the wrong way.  What I need
is an association table that maps a Person and a role.

I think what I need is a person_role_id field in the Patient class/
table, which refers to an entry in the Person_Role table.  That table
would hold a person_role_id field, a person_id field, and a role_id
field.  The role_id field is probably an enumeration of the various
roles permitted in the system, so one value would mean 'Patient'.

By this method, the Patient class/table would no longer hold an id
field for each of the possible roles a person can serve as.

Unfortunately, I've been unable to determine how to perform this
mapping.  You would think that this kind of situation is common enough
that Elixir/SQLAlchemy would make it easy, but if that's the case, I
haven't seen it yet.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"SQLElixir" 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/sqlelixir?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to