[email protected] wrote: > > assembling the test was a good exercise as I can see that the problem > exists with 0.5.3 but not against 0.5.4p2 or a checked out copy of > svn. > > I logged this ticket but more for reference/tracking than anything > else. > http://www.sqlalchemy.org/trac/ticket/1464
yah that had been resolved by 0.5.4 but in my poking around to understand it I found a not totally related bug related to pickling which I just fixed in r6100. > > > pjjH > > > On Jul 10, 1:14 pm, "[email protected]" > <[email protected]> wrote: >> Sure. I'll work on the distillation after lunch. It is not that the >> UPDATE is broken, per se, it is more that update should not be called. >> The code below works OK on an empty database but fails on subsequent >> runs when pre-existing data is found. >> >> tmp = [ >> { 'md5id': 32, 'scenario': 100, 'value': 21. }, >> { 'md5id': 57, 'scenario': 200, 'value': -3. }, >> ] >> >> for i in tmp: >> o = ModelPresentValue() >> o.md5id = i['md5id'] >> o.scenario = i['scenario'] >> o.value = i['value'] >> session.merge(o) >> >> On Jul 10, 12:21 pm, "Michael Bayer" <[email protected]> wrote: >> >> > well can you distill it into a small test case...it seems suspect that >> > "UPDATE" would break. more likely is, __init__ doesn't work correctly >> or >> > perhaps history events fail. >> >> > [email protected] wrote: >> >> > > I found the problem: it is with the instrumentation_finders stuff >> you >> > > helped us with months ago (see below). The problem can be reproduced >> > > with this: >> >> > > class DummyMapperExtension(MapperExtension): >> > > pass >> >> > > mapper(ModelPresentValue, model_present_value, >> > > extension=DummyMapperExtension()) >> >> > > If the instrumentation hook is put in and you use a mapper extension >> > > (even a dummy one) then the session update code stops working. >> >> > > instrumentation + mapper_extension => fail >> > > instrumentation only => works >> > > mapper_extension only => works >> >> > > I tried debugging the instrumentation_find stuff before but didn't >> > > make much progress. I will open up a ticket on trac (if there isn't >> > > one there already) >> >> > > pjjH >> >> > > # Set docstrings of attributes to the empty string, in order to >> avoid >> > > # ugly-looking stuff that would otherwise appear as default. >> > > class AttachNotesAsDocstring(interfaces.InstrumentationManager): >> > > def instrument_attribute(self, class_, key, attr): >> > > if isinstance(attr.property, properties.ColumnProperty): >> > > if hasattr(attr.property.columns[0], 'info'): >> > > attr.__doc__ = attr.property.columns[0].info.get >> > > ('notes') >> > > else: >> > > attr.__doc__ = '' >> >> > > # We get a weird error from SQLAlchemy when we have customized >> > > # instrumentation and try to cog a file: >> > > # >> > > # AttributeError: 'ColumnProperty' object has no attribute >> > > 'strategy' >> > > # >> > > # As a workaround, we do not attempt to do any fancy instrumentation >> > > # if the cog module has been imported. >> > > if not 'cog' in sys.modules: >> > > sqlalchemy.orm.attributes.instrumentation_finders.append( >> > > lambda cls: AttachNotesAsDocstring) > > > --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---
