Creating a New Storage Plugin
For the purposes of this tutorial, I will assume you are creating a new storage
Plugin infinite
, and the code for that plugin lives in
$HOME/git/plugins/storage/infinite
.
Create the Code
Create the following filesystem structure in
$HOME/git/plugins/storage/infinite
:Within this file, you must define the following classes, which must be named EXACTLY as specified, otherwise SIERRA will not detect them.
import pandas as pd import pathlib def df_read(path: pathlib.Path, **kwargs) -> pd.DataFrame: """ Return a dataframe containing the contents of the CSV at the specified path. For other storage methods (e.g. database), you can use a function of the path way to uniquely identify the file in the database (for example). """ def df_write(df: pd.DataFrame, path: pathlib.Path, **kwargs) -> None: """ Write a dataframe containing to the specified path. For other storage methods (e.g. database), you can use a function of the path way to uniquely identify the file in the database (for example) when you add it. """
Connect to SIERRA
Put
$HOME/git/plugins
on yourSIERRA_PLUGIN_PATH
. Then your plugin can be selected as--exec-env=storage.infinite
.
Note
Storage plugin names have the same constraints as python package names (e.g., no dots).