For the complete documentation index, see llms.txt. This page is also available as Markdown.

Notebook

class Notebook

An interface for working with notebooks on Redivis.

Constructors

redivis.current_notebook()

Get a reference to the current notebook. Can only be called from within a running Redivis notebook.

redivis.notebook(name)

Create a reference to a notebook based on its (qualified) name

Workflow.notebook()

Return a notebook within a specific workflow.

Workflow.list_notebooks()

Returns a list of Notebooks within a workflow

Examples

username = "imathews"
workflow_name = "example_workflow_climate_analysis:x7kh"
notebook_name = "visualize_precipitation_trends:2f2v"

notebook = redivis.notebook(f"{username}.{workflow_name}.{notebook_name}")
notebook.run()
df = get_dataframe_somehow()

notebook = redivis.current_notebook()

# Create an output table on the current notebook
# Optional parameter, append (default False), determines whether the output appends to
#  or replaces the output table.
notebook.create_output_table(df, append=False) 

# Can also pass a path to a parquet file or csv
notebook.create_output_table("path/to/file.parquet")

Attributes

workflow

A reference to the Workflow instance that is associated with this notebook.

properties

A dict containing the API resource representation of the notebook. This will only be populated after certain methods are called, particularly the get method, and will otherwise be None.

qualified_reference

The fully qualified reference to this notebook

For example,

scoped_reference

The canonical reference for the notebook, without any qualifiers. E.g., visualize_precipitation_trends:2f2v

Methods

notebook.create_output_table(data[, ...])

Create or append to an output table, using data from within the (running) notebook.

notebook.get()

Fetches the notebook, after which notebook.properties will contain a dict with entries corresponding to the properties on the notebook resource definition. Will raise an error if the notebook does not exist.

notebook.exists()

Check whether the notebook exists.

notebook.output_table()

Get a reference to the notebook's output table, if it exists.

notebook.run([*, wait_for_finish=True])

Run a notebook.

notebook.referenced_tables()

Get an ordered list of tables referenced by the notebook.

notebook.source_table()

Get the notebook's source table.

notebook.stop()

Stop a running notebook.

notebook.update([*, name, source_table])

Update the notebook's name and/or source.

Was this helpful?