Re: [sqlalchemy] Events (load and after_attach) for instance stamping

2013-01-11 Thread YKdvd
That sounds even nicer, and since I'm just starting out with no legacy code I've been meaning to try dropping 0.8 in even before it is final. It sounds like I could just do something like event.listen(MyDeclarativeSubclass, load, myStamperFunc). I popped in 0.8b2 and tried something

Re: [sqlalchemy] Events (load and after_attach) for instance stamping

2013-01-11 Thread Michael Bayer
On Jan 11, 2013, at 10:19 AM, YKdvd wrote: That sounds even nicer, and since I'm just starting out with no legacy code I've been meaning to try dropping 0.8 in even before it is final. It sounds like I could just do something like event.listen(MyDeclarativeSubclass, load, myStamperFunc).

Re: [sqlalchemy] Events (load and after_attach) for instance stamping

2013-01-11 Thread Michael Bayer
On Jan 11, 2013, at 2:26 AM, YKdvd wrote: On Friday, January 11, 2013 2:34:09 AM UTC-4, Michael Bayer wrote: you can associate the instance event with the mapper() callable or Mapper class, and it will take effect for all mapped classes. I think that would work for my case, although

Re: [sqlalchemy] Events (load and after_attach) for instance stamping

2013-01-11 Thread YKdvd
On Friday, January 11, 2013 11:25:06 AM UTC-4, Michael Bayer wrote: in theory. It's new stuff and was very tricky to get it to work, so feel free to send a brief test along. Here's a minimal example I quickly put together - it retrieves from the database, but the handler doesn't seem to

Re: [sqlalchemy] Events (load and after_attach) for instance stamping

2013-01-11 Thread Michael Bayer
On Jan 11, 2013, at 11:35 AM, YKdvd wrote: On Friday, January 11, 2013 11:25:06 AM UTC-4, Michael Bayer wrote: in theory. It's new stuff and was very tricky to get it to work, so feel free to send a brief test along. Here's a minimal example I quickly put together - it retrieves from

[sqlalchemy] Events (load and after_attach) for instance stamping

2013-01-10 Thread YKdvd
In the MySQL system I'm redoing with SQLAlchemy, there is effectively a master' schema that exists once top-level stuff (including a table describing projects) , and project schemas (one identical set of tables per project), which have project-level stuff. When an object is retrieved from a

Re: [sqlalchemy] Events (load and after_attach) for instance stamping

2013-01-10 Thread Michael Bayer
On Jan 11, 2013, at 1:22 AM, YKdvd wrote: SQLA's event system has the after_attach session event. Hooking into this works for new instances I attach to a session with add(), but does't fire when items are loaded from a query - presumably attached means direct userland attachment only,

Re: [sqlalchemy] Events (load and after_attach) for instance stamping

2013-01-10 Thread YKdvd
On Friday, January 11, 2013 2:34:09 AM UTC-4, Michael Bayer wrote: you can associate the instance event with the mapper() callable or Mapper class, and it will take effect for all mapped classes. I think that would work for my case, although I'm a little fuzzy as to the exact syntax to