File

class File

An interface for working with files on Redivis. When the constructor is called directly, a file_id must be provided. Also returned by listing files associated with a particular table or query result.

Constructors

List files contained within a query result. The query result must contain at least one file_id variable.

Construct a reference to a file based on its globally unique id.

List files contained within a file index table. The table must contain at least one file_id variable.

Examples

f = redivis.file("4c10-d8rqhswh8.zz7AB9NJB2ctNpDGKbRD7w")

download_path = f.download("./my-downloads")

with open (download_path, "r") as f:
    # Do stuff with the file!

Attributes

id

The globally unique identifier for the file, as a string.

query

properties

  • id str: The globally unique id of the file

  • name str: The name of the file, including any extensions

  • size int: The size of the file, in bytes

  • contentType str: The MIME type associated with the file's extension, when available

  • md5Hash str: The md5 checksum of the file, as a base64 string

table

Methods

Download the file.

Get file metadata, after which file.properties will be fully populated.

Read the file contents into memory, either as bytes (the default) or as a string if as_text=True.

Read the file as a BytesIO stream, similarly to if it was located on disk.

Last updated