you might want to try:

        mapper (someclass, sometable, properties = {
                        'rels' : relation(someotherclass, lazy=None)
                })

which will turn off all loading on the "rels" attribute.    im not  
sure how well thats going to work since it hasnt been tested very  
strongly within the context of a flush(), etc.  but it fixes your  
unit test even when a flush() is added to the bottom.

if you have half a million "rels", then the relation() function is  
not particularly useful for loads since theres currently no way to  
limit the rows you fetch.

it seems like the overall feature youre looking for is "extra lazy  
loading", which is a pretty large feature.  adding small hacks to  
attributes.py is only going to complicate the attributes module  
unnecessarily and not really going to solve the issue.

or maybe you just want "rels" to be there for the purposes of flush()  
but you dont care about loading; in that case maybe the above solves  
it (then again why even bother having a "rels" attribute?  why not  
just define the relation in the other direction only? )

one goal of SA is to not add huge complication to the core just to  
suit relatively rare use cases, such as heavy manipulation of  
detached objects with lazy loaders attached to them.  if you want the  
benefits of lazy loading, then you have to have the objects in a  
session.



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Sqlalchemy-users mailing list
Sqlalchemy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users

Reply via email to