Working with non-tabular files

Load a single file

import redivis
from PIL import Image

# References the file bogota.tiff at
file = redivis.file("4c10-d8rqhswh8.zz7AB9NJB2ctNpDGKbRD7w")
file.get() # is now populated

# Download the file
download_location ="./my-downloads")
f = open(download_location, "r")

# Read the image file
file_content_bytes =
# Pass the file as a bytesIO stream to PIL to load as an image

# We can also work with text file data, e.g.:
file = redivis.file("4c10-bk27tqmet.rkgXgUlmnJrEFFC6oWAqqA")
file_content_string =
with TextIOWrapper( as f:
  f.readline() # read first line

Load all files in a table

import redivis

table = redivis.organization("Demo").dataset("example_data_files").table("example_file_types")

# Download all files

# Read all files into memory — only do this for a few small files!
files = table.list_files()
file_content_bytes = [
    for file in files

Last updated