percious wrote: > > question. > > Lets say I have a series of table definitions, and a series of objects > linked to the tables with a bunch of mappers. > > First question: Is there a way to get from the table definitions in > the metadata to the Mapper?
not conveniently. you could loop through the dictionary of mappers in sqlalchemy.orm.mapperlib.mapper_registry and just look at all the "mapped_table" attributes of those mappers. or just track yourself. > > Second question: If I create a MapperExtension, can I then link it to > the mapper associated with a table? MapperExtensions currently like to be set at the time of mapper construction. there is also a way to say query.options(extension(someext)), but theres a pending ticket which is needed for some fixes to that...also that only sets an extension that takes place within the realm of a select. > > What I want to do is create a simple application that goes through the > tables defined within a metadata, and create an extension so that > every time a table entry is added it prints 'hello world' to the > screen. yah that pattern is not really supported. tables/mappers/etc like to be constructed and then not changed after that, so if you cant apply your "hello world" function at table/mapper construction time, the closest thing you could do is either use a customized logging stream to trap INSERT statements, or if you used DynamicMetaData you could have it connect() to a ProxyEngine instance which does similar. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---