Skip to main content

Managing files with H2O Drive

This page provides information on how to use H2O Drive for data management in JupyterLab.

  • In the H2O AI Cloud environment, the running Notebook and JupyterLab environments operate on separate machines. This separation helps with cost control and improves operationalization when you’re ready to productionalize your notebooks.
  • H2O Drive allows you to upload files from your local machine or other locations directly into your cloud environment. You can access H2O Drive from the H2O AI Cloud homepage.
  • After you’ve uploaded your data, you can manage files in your H2O Drive storage directly from your Python environment. The following sections describe how to list files in your storage and download them to your local environment.

List files in your Storage

Use the following code to connect to H2O Drive and list all files in your storage:``

import h2o_drive

# Connect to your storage
drive_client = await h2o_drive.Drive()
my_bucket = drive_client.my_bucket()

# View all files in your storage
all_objects = await my_bucket.list_objects()
print([o.key for o in all_objects])

This code connects to your H2O Drive instance and prints a list of file names in your storage.

Download a file from H2O Drive

To download a file from your H2O Drive storage to your local environment, use the following code:

# Download the file first to the notebook
await my_bucket.download_file(all_objects[0].key, "./downloaded-file.csv")

Feedback