MCPcopy Create free account
hub / github.com/requests-cache/requests-cache / bulk_commit

Method bulk_commit

requests_cache/backends/sqlite.py:283–295  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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):

Callers 6

recreate_keysMethod · 0.80
test_bulk_commitMethod · 0.80
do_noop_bulkMethod · 0.80
populate_cacheFunction · 0.80
convert_cacheFunction · 0.80

Calls 1

_acquire_sqlite_lockMethod · 0.95

Tested by 4

test_bulk_commitMethod · 0.64
do_noop_bulkMethod · 0.64
populate_cacheFunction · 0.64