Insert a large number of records within a single transaction Example: >>> d1 = SQLiteDict('test') >>> with d1.bulk_commit(): ... for i in range(1000): ... d1[i] = i * 2
(self)
| 281 | |
| 282 | @contextmanager |
| 283 | def bulk_commit(self): |
| 284 | """Insert a large number of records within a single transaction |
| 285 | |
| 286 | Example: |
| 287 | |
| 288 | >>> d1 = SQLiteDict('test') |
| 289 | >>> with d1.bulk_commit(): |
| 290 | ... for i in range(1000): |
| 291 | ... d1[i] = i * 2 |
| 292 | |
| 293 | """ |
| 294 | with self._acquire_sqlite_lock(): |
| 295 | yield |
| 296 | |
| 297 | @contextmanager |
| 298 | def _acquire_sqlite_lock(self): |