Skip to main content

bauplan.store

This module contains methods to interact with Bauplan key-value object store. In particular, it provides methods to save and load Python objects from the store: for example, you main save a scikit model after training and load it later to make predictions, or you may pass a parameter outside of the usual Arrow tables between nodes.

Note that some basic checks are performed to ensure that the object can be serialized and deserialized.

import bauplan

# train a model
tree = DecisionTreeClassifier().fit(X, y)
# save the model in the store
bauplan.store.save_obj("tree", tree)

# later in the DAG, retrieve the model with the same key
tree = bauplan.load_obj("tree")
# use the Python object as intended, e.g. make predictions
y_hat = tree.predict(X_test)

def load_obj

Return the Python object previously stored at the given key.

Parameters

keystr

the key associated with the object to retrieve.


def save_obj

Store a Python object with a key, to be later retrieved in other parts of the DAG.

Parameters

keystr

the key associated with the object to store.

objtyping.Any

the Python object to store, must be serializable using pickling