Solved it. The function is
from sqlalchemy.orm.attributes import QueryableAttribute
def getattr_does_emit_sql(model, attr_name):
return (attr_name not in model.__dict__
and hasattr(type(model), attr_name
and isinstance(getattr(type(model), attr_name), QueryableAttribute)
)