On Thursday 25 September 2008 04:30:19 Michael Bayer wrote: > On Sep 24, 2008, at 6:23 AM, [EMAIL PROTECTED] wrote: > > hi > > i have cascade= option of relation switched automaticaly between > > "all" and other values, and nothing. so i used cascade=None as > > nothing, hoping it will get the default behaviour. the result was > > some query got 6x slower (actualy thats why i went hunting it)... > > > > nope, it happens that source-wise, exactly cascade=False triggers > > the default behavior (whatever that is) and nothing else. Not > > really intuituve, well, fine, i'll fix me code, but the question > > still remains: > > why cascade=None or cascade='' or whatever empty thing makes > > queries (sqlite) sooo slow. > > i've compared the sql of the query - it's same. > > something in the schema went wrong? or result-processing? or > > what? is it worth chasing or there is a known reason? > > wild guess, something to do with objects that normally would have > been cascaded into the session were not, and are being loaded > instead. but otherwise no clue, you'd have to provide specifics. i digged further.. it's an implicit m2m relation, and with cascade=None it makes/pulls into the session some parasite incomplete m2m records (with one link being null) - one per each normal record. and seems that gives sqlite headaches.
> > and a related suggestion: why not use symbols e.g. some singleton > > called DefaultValue, instead of any hard-to-guess default values > > (be them False, None, '', whatever)? the actual default values > > are mostly set up later, so the > > if something is DefaultValue: something = actual-default-value > > is there anyway. > i think the "foo=False" as a default might have been some habit I > picked up when looking at the source code to SQLObject (or maybe > SQLObject2). > > I didn't think we had too much public API with the "default=False" > thing going on but I havent taken a poll. Usually these defaults > should just be documented. A symbol like "DefaultValue" might be > nice except I don't see how that's any more obvious for someone who > isn't reading docstrings. well, it can go in interfaces.py and be documented with one sentence somewhere at the top of doco, and be used everywhere a None cannot - e.g. in the lazy= argument, or in this cascade=, i.e. where None has other meaning or is meaningless. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~---