(self)
| 3159 | sa_exc.SAWarning, |
| 3160 | ) |
| 3161 | def _autoflush(self) -> None: |
| 3162 | if self.autoflush and not self._flushing: |
| 3163 | try: |
| 3164 | self.flush() |
| 3165 | except sa_exc.StatementError as e: |
| 3166 | # note we are reraising StatementError as opposed to |
| 3167 | # raising FlushError with "chaining" to remain compatible |
| 3168 | # with code that catches StatementError, IntegrityError, |
| 3169 | # etc. |
| 3170 | e.add_detail( |
| 3171 | "raised as a result of Query-invoked autoflush; " |
| 3172 | "consider using a session.no_autoflush block if this " |
| 3173 | "flush is occurring prematurely" |
| 3174 | ) |
| 3175 | raise e.with_traceback(sys.exc_info()[2]) |
| 3176 | |
| 3177 | def refresh( |
| 3178 | self, |
no test coverage detected