Tags: advanced-user, how-to

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#

  1. Retrieve the file record of interest, for example by name:

    file_upd = db.File(name="TestFile").retrieve()
    
  2. Set file_upd.file to the path of the new local file to upload:

    file_upd.file = str(DATA_DIR/"data.csv")
    

    file_upd.path holds the server-side path of the file, which stays unchanged after the update.

  3. Push the update:

    file_upd.update()