How to Update a File#
This guide shows how to replace the content of an existing file record with a new local file, keeping the same record and server-side path.
Prerequisites#
PyLinkAhead must be installed and a connection configured. See Setting Up PyLinkAhead and How to Configure PyLinkAhead.
Steps#
Retrieve the file record of interest, for example by name:
file_upd = db.File(name="TestFile").retrieve()
Set
file_upd.fileto the path of the new local file to upload:file_upd.file = str(DATA_DIR/"data.csv")
file_upd.pathholds the server-side path of the file, which stays unchanged after the update.Push the update:
file_upd.update()