pandas.HDFStore.flush#
- HDFStore.flush(fsync=False)[source]#
Force all buffered modifications to be written to disk.
Useful when sharing access between processes – call
flush(withfsync=Trueif needed) before releasing a write lock so that readers see the latest data.- Parameters:
- fsyncbool, default False
Call
os.fsync()on the file handle to force writing to disk.
See also
HDFStore.closeClose the underlying PyTables file handle.
Notes
Without
fsync=True, flushing may not guarantee that the OS writes to disk. With fsync, the operation will block until the OS claims the file has been written; however, other caching layers may still interfere.Examples
>>> df = pd.DataFrame([[1, 2], [3, 4]], columns=["A", "B"]) >>> store = pd.HDFStore("store.h5", "w") >>> store.put("data", df) >>> store.flush(fsync=True) >>> store.close()