(sent again from the correct email address)
Michael Bayer wrote:
get ready for a long one...(this has a lot of unedited thought process in it) ...lots of good, unedited thought process' snipped..... But now, both of you want to have two way relationships, *and* you want to set them in both directions, *and* you want the objects to be in a completely valid state after commit.

Well, it's not so much we want all those things, but those things are part of
the contract that a two way relationship implies and experimentation showed a
different behaviour than expected. While, not anticipating that a first release
will be anywhere near feature complete, SQLAlchemy is amazing in what it can do
at this point and this fact has possibly put the expectation level up across the
board. That said, software is often more about compromises than anything else,
so it is necessary to discover and/or be informed in some way of what those
compromises to date have been.

I tried to think of every
possible contingency before putting this thing out publically, but there you go, only a week later and ive already been hit with like, a dozen.


People never do what you expect, even software people :-)


I am going to ponder the "auto-backreference" attribute idea a little further.

It might look something like:

Course.mapper = mapper(Course, courseTbl)
Student.mapper = mapper(Student, studentTbl, properties={
'courses': relation(Course.mapper, enrolTbl, lazy=False, backreference='students')
})


Can I suggest that you make it more explicit, something like:

Student.mapper = mapper(Student, studentTbl, properties={
        'courses': two_way_relation(Course.mapper, enrolTbl, lazy=False)})

or many_to_many_relation() or even just association().

With the default that the related entity is the mapper that it is being added
to, and allowing an explicit 'with=Admin.mapper' keyword to specify the related
entity. This would allow any other 2-way relation specific properties to be
specified w/o polluting the existing relation() interface, such as 'onChange' or
more explicitly, 'onAppend=', 'onDelete', etc for the callbacks in TreeNode 
example.


hey wow, this *might* work and not even require much code at all....basically, if it works in the ZBlog app, it'll probably work anywhere.


Be careful with those assumptions :-))

Robert




-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Sqlalchemy-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users

Reply via email to