On Thursday, September 26, 2019 at 1:07:29 PM UTC-4, Simon King wrote: > That sounds like it would have to be application-specific. I don't > know how SQLAlchemy can tell that you've finished adding tables and > mappers.
Some of that is application specific, but there must be an event that can let me figure that out... It looks like I may be able to handle it with event: from sqlalchemy import event from sqlalchemy.orm import mapper @event.listens_for(mapper, 'mapper_configured') def mapper_configured__mapper(mapper, class_): if not hasattr(class_, '_association_proxies'): class_._association_proxies = {} for k, v in dict(class_mapper(class_).all_orm_descriptors).items(): if isinstance(v, AssociationProxy): class_._association_proxies[k] = (v.target_collection, v. value_attr) that appears to trigger only once, when the class is mapped. If I were to map again, I can catch that. But it's not being invoked on every query or session... this will likely break on more advanced association proxies... but it's solving my immediate problem. -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com/help/mcve for a full description. --- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sqlalchemy/46aabbb6-e6c3-4c1b-98d6-c5793335edce%40googlegroups.com.