quantlab.utils.atomic.write_parquet_atomically#
- quantlab.utils.atomic.write_parquet_atomically(path, frame)[source]#
Write
frameas parquet topathwith an atomic replace.The frame is written to a temporary file in the destination’s directory (created if missing) and renamed over it, so an interrupted write leaves either the previous complete file or the new one. The file gets the permissions a plain write would (
0o666less the umask). On any exception the temporary file is removed and the exception propagates.- Parameters:
- pathstr | Path
Destination file.
- framepolars.DataFrame
Anything with a
write_parquet(path)method; this module imports only the standard library.
Examples
>>> import polars as pl >>> write_parquet_atomically("raw/tickers.parquet", pl.DataFrame({"ticker": ["AAPL"]}))