src/risclog/sqlalchemy/cache.py
def _sync_relationship_attrs(self):
        """
        Synchronize relationship attributes with their corresponding ID
        attributes.

        When using SQLAlchemy bulk functionality, the ORM behavior is changed
        in multiple ways. One important change is that relationship attributes
        aren't evaluated anymore.
        To still handle related object as expected, we iterate over
        relationship attributes and set their corresponding ID attributes on
        the same object.
        """
        for objects in self._cached_instances.values():
            objects = self._filter_sa_result_objects(objects)
            if len(objects) == 0:
                continue
            model = type(list(objects)[0])

            rel_map = [
                (rel.key, pair[1].key, pair[0].key)
                for rel in inspect(model).relationships
                for pair in rel.local_remote_pairs
                if rel.direction is not sqlalchemy.orm.interfaces.ONETOMANY
            ]
            for object in objects:
                for from_obj, from_attr, to_attr in rel_map:
                    if getattr(object, to_attr, None) is None:
                        setattr(
                            object,
                            to_attr,
                            getattr(
                                getattr(object, from_obj), from_attr, None
                            ),
                        )

        Synchronize relationship attributes with their corresponding ID
        attributes.

        When using SQLAlchemy bulk functionality, the ORM behavior is changed
        in multiple ways. One important change is that relationship attributes
        aren't evaluated anymore.
        To still handle related object as expected, we iterate over
        relationship attributes and set their corresponding ID attributes on
        the same object.
        
Synchronize relationship attributes with their corresponding ID
attributes.

When using SQLAlchemy bulk functionality, the ORM behavior is changed
in multiple ways. One important change is that relationship attributes
aren't evaluated anymore.
To still handle related object as expected, we iterate over
relationship attributes and set their corresponding ID attributes on
the same object.
Synchronize relationship attributes with their corresponding ID attributes . When using SQLAlchemy bulk functionality the ORM behavior is changed in multiple ways . One important change is that relationship attributes aren ' t evaluated anymore . To still handle related object as expected we iterate over relationship attributes and set their corresponding ID attributes on the same object .
def _sync_relationship_attrs(self):
        for objects in self._cached_instances.values():
            objects = self._filter_sa_result_objects(objects)
            if len(objects) == 0:
                continue
            model = type(list(objects)[0])
            rel_map = [
                (rel.key, pair[1].key, pair[0].key)
                for rel in inspect(model).relationships
                for pair in rel.local_remote_pairs
                if rel.direction is not sqlalchemy.orm.interfaces.ONETOMANY
            ]
            for object in objects:
                for from_obj, from_attr, to_attr in rel_map:
                    if getattr(object, to_attr, None) is None:
                        setattr(
                            object,
                            to_attr,
                            getattr(
                                getattr(object, from_obj), from_attr, None
                            ),
                        )
def _sync_relationship_attrs ( self ) : for objects in self . _cached_instances . values ( ) : objects = self . _filter_sa_result_objects ( objects ) if len ( objects ) == 0 : continue model = type ( list ( objects ) [ 0 ] ) rel_map = [ ( rel . key , pair [ 1 ] . key , pair [ 0 ] . key ) for rel in inspect ( model ) . relationships for pair in rel . local_remote_pairs if rel . direction is not sqlalchemy . orm . interfaces . ONETOMANY ] for object in objects : for from_obj , from_attr , to_attr in rel_map : if getattr ( object , to_attr , None ) is None : setattr ( object , to_attr , getattr ( getattr ( object , from_obj ) , from_attr , None ) , )
Synchronize relationship attributes with their corresponding ID
attributes.
Synchronize relationship attributes with their corresponding ID attributes .
"""
        Synchronize relationship attributes with their corresponding ID
        attributes.

        When using SQLAlchemy bulk functionality, the ORM behavior is changed
        in multiple ways. One important change is that relationship attributes
        aren't evaluated anymore.
        To still handle related object as expected, we iterate over
        relationship attributes and set their corresponding ID attributes on
        the same object.
        """
self