src/risclog/sqlalchemy/cache.py
def save_changes(self, session=None, cursor=None):
        """
        Flush modified and created object to the database before clearing the
        cache.

        Args:
            session: A SQLAlchemy session to use instead of the default one.
        """
        self.log_memory_usage()

        if session is None:
            session = self.session
        if cursor is None and self._use_copy:
            cursor = self.session.using_bind(
                self._engine_name).connection().connection.cursor()

        self._log('debug', 'Flushing model cache.')
        self._assign_sequences()
        self._sync_relationship_attrs()

        for model_name in self._save_order:
            if model_name not in self._cached_instances:
                continue
            objects = self._cached_instances[model_name]
            objects = self._filter_sa_result_objects(objects)
            if len(objects) == 0:
                continue

            self._deregister_change_handler(
                type(objects[0]), self._instance_change_handler)
            new_objects, updated_objects = [], []

            for object in objects:
                if attributes.instance_state(object).key is None:
                    new_objects.append(object)
                else:
                    updated_objects.append(object)

            if self._use_copy:
                self._save_by_copy(cursor, new_objects)
            else:
                session.bulk_save_objects(new_objects)
            session.bulk_save_objects(updated_objects)
            session.flush()

        if self._use_copy:
            cursor.connection.commit()

        self.clear(session)
        self._log('info', 'Flushed model cache.')

        Flush modified and created object to the database before clearing the
        cache.

        Args:
            session: A SQLAlchemy session to use instead of the default one.
        
Flush modified and created object to the database before clearing the
cache.
Flush modified and created object to the database before clearing the cache .
def save_changes(self, session=None, cursor=None):
        self.log_memory_usage()
        if session is None:
            session = self.session
        if cursor is None and self._use_copy:
            cursor = self.session.using_bind(
                self._engine_name).connection().connection.cursor()
        self._log('debug', 'Flushing model cache.')
        self._assign_sequences()
        self._sync_relationship_attrs()
        for model_name in self._save_order:
            if model_name not in self._cached_instances:
                continue
            objects = self._cached_instances[model_name]
            objects = self._filter_sa_result_objects(objects)
            if len(objects) == 0:
                continue
            self._deregister_change_handler(
                type(objects[0]), self._instance_change_handler)
            new_objects, updated_objects = [], []
            for object in objects:
                if attributes.instance_state(object).key is None:
                    new_objects.append(object)
                else:
                    updated_objects.append(object)
            if self._use_copy:
                self._save_by_copy(cursor, new_objects)
            else:
                session.bulk_save_objects(new_objects)
            session.bulk_save_objects(updated_objects)
            session.flush()
        if self._use_copy:
            cursor.connection.commit()
        self.clear(session)
        self._log('info', 'Flushed model cache.')
def save_changes ( self , session = None , cursor = None ) : self . log_memory_usage ( ) if session is None : session = self . session if cursor is None and self . _use_copy : cursor = self . session . using_bind ( self . _engine_name ) . connection ( ) . connection . cursor ( ) self . _log ( 'debug' , 'Flushing model cache.' ) self . _assign_sequences ( ) self . _sync_relationship_attrs ( ) for model_name in self . _save_order : if model_name not in self . _cached_instances : continue objects = self . _cached_instances [ model_name ] objects = self . _filter_sa_result_objects ( objects ) if len ( objects ) == 0 : continue self . _deregister_change_handler ( type ( objects [ 0 ] ) , self . _instance_change_handler ) new_objects , updated_objects = [ ] , [ ] for object in objects : if attributes . instance_state ( object ) . key is None : new_objects . append ( object ) else : updated_objects . append ( object ) if self . _use_copy : self . _save_by_copy ( cursor , new_objects ) else : session . bulk_save_objects ( new_objects ) session . bulk_save_objects ( updated_objects ) session . flush ( ) if self . _use_copy : cursor . connection . commit ( ) self . clear ( session ) self . _log ( 'info' , 'Flushed model cache.' )
Flush modified and created object to the database before clearing the
cache.
Flush modified and created object to the database before clearing the cache .
"""
        Flush modified and created object to the database before clearing the
        cache.

        Args:
            session: A SQLAlchemy session to use instead of the default one.
        """
self
session
A SQLAlchemy session to use instead of the default one.
A SQLAlchemy session to use instead of the default one .
cursor