I'm not sure if I just haven't figured out how to map objects correctly yet, or if I am trying to automate something that cannot be automated in SA. I've played with mapping options, like relations, backref's, and cascade options. I can't seem to achieve automation with my objects in the way I would like.
In a standard many-to-one scenario, here is the behavior I would like: When I try to modify the 'one' record, it will automatically create a new record if it does not exist--rather than update the existing one. Consider the following example. # This is pseudo syntax for brevity... Let me know if actual code is necessary. Data in 'host_table': # hostname, platform.osname host1, linux host2, linux host3, windows host4, windows Data in 'platform' table: # osname linux windows If I create an object to represent the third record in host_table, host3, and change 'windows' to 'bogus', it effects a change in the platform table. The 'windows' record becomes 'bogus'. That changes the platform for host4 to bogus and that is not what I wanted: Data in host_table: host1, linux host2, linux host3, bogus host4, bogus Data in platform: linux bogus What I want to see is: Data in host_table: host1, linux host2, linux host3, bogus host4, windows Data in platform: linux windows bogus I think I'm looking for a something like a 'noreplace-codependents' cascade behavior. Of course, this is a difficult thing to automate. For example, what if you really do want to modify the non-orphan (sometimes)? I'm thinking I just need to make a decorator class and deal with it myself in a transaction context. Don't suppose there is a SA solution for this that I am missing? Thanks, Rick --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
