Hi, Sorry for the last mail, which i sent in error, before finishing it. If you(Michael) still have it in the filter, please just reject it.
I am working on a notification framework, which saves the dirty, new and deleted states of objects in sessions to an Eventlog at commit time. The target is to have asynchronous agents listening to table changes and a sqla extension to notify them when data is written to db. The notification sender core code is written as a SessionExtension at the moment. The design uses the postgres NOTIFY / listen statements, and a table (event_log) for carrying the per commit information of primary id's which have added/deleted/modified. I know that NOTIFY is not sql standard, but many dbs have some sort of notification capability. So i think a general case is abstractable from this db agnostic proposal (=pg's NOTIFY). It is even conceivable to send the notification event through OS services, while still keep the notification data in the db. I have already implemented this simple protocol: before_commit(self, session): event_data=# get all pks for session.['dirty', 'new', 'deleted'] for each x of [dirty', 'new', 'deleted'] session.add(Event( data=event_data[x])) session.add(Event(data=event_data)) # gener for each object type: for each notification type: #= one of (dirty', 'new', 'deleted') self.pending_notifications = [self.get_table_name(class_)] ^^^^ First Question: How does SQLAlchemy map the call to session.query(MappedObject) to a MetaData.tables[x]. Is there any way to do this without using a custom mapper fuction ? I would prefer using the same mechanism as SQLAlchemy self.pending_notifications += General Event for table after_commit: send Notifications on separate db agnostic connection (in pg i need to set a different isolation level) My second concern is about what session.execute("UPDATE table_x set pop = ''newval") actually does. Is the sql statement parsed for table names? My interest would be in marking the objects which are changed by this update as dirty. So what i am really looking for is a method to generate Note that i use pk=Primary Key 'SELECT pk1, pk2 ...., change_field from tablename where prop=x' from an update: 'UPDATE tablename set change_field=... where prop=x' This would enable me to generate a dirty pk list from any (text) sql statement accepted by sqla. Please let me know if you feel that this design is not the 'sqla way to do things'. I want to OS the code, but i wanted to get an short feedback if this is of any use for anyone out there. So please comment :) paul -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalch...@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.