Hey all, Before 0.4.5 I used this code to get the mapped class for a table. It worked fine, but mapper_registry was made private in 0.4.5 and the private function does not behave the same way for some reason. But as this code is pretty nasty anyway I was wondering if there was a better way to do this. If not, can anyone hint me how to make this work again?
If you are wondering, I need this for asynchronous updates in postgres. The modification table holds the table name for a modification and inserted by a trigger. Koen classTableCache = dict() def classForTable(tableName): """Returns the mapped class for a particular table name.""" if classTableCache == dict(): for table in metadata.table_iterator(reverse=False): for mapper in mapperlib.mapper_registry.values(): if table == mapper.base_mapper.mapped_table: # This is an extremely ugly hack that only works when all patent mapper names # are longer than inherited mapper names if classTableCache.has_key(table.name): if len(str(mapper.class_)) < len(str(classTableCache[table.name])): classTableCache[table.name] = mapper.class_ else: classTableCache[table.name] = mapper.class_ return classTableCache[tableName] --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---