# redivis

## *module* <mark style="color:purple;">Redivis</mark>

The redivis module, available via `import redivis`. Through this module and its methods, you can create, update, delete, query, and read from various resources on Redivis.

## Attributes

| **`__version__`** | The current version of this library |
| ----------------- | ----------------------------------- |

## Methods

<table data-header-hidden><thead><tr><th width="441"></th><th></th></tr></thead><tbody><tr><td><a href="redivis/redivis.current_notebook"><strong><code>redivis.current_notebook</code></strong></a>()</td><td>Construct a reference to the current notebook. Can only be called within a Redivis notebook.</td></tr><tr><td><a href="redivis/redivis.current_user"><strong><code>redivis.current_user</code></strong></a>()</td><td>Construct a reference to the currently authenticated user.</td></tr><tr><td><a href="redivis/redivis.current_notebook"><strong><code>redivis.current_workflow</code></strong></a>()</td><td>Construct a reference to the current workflow. Can only be called within a Redivis notebook, or if a <a href="..#environment-variables">default workflow is set</a>.</td></tr><tr><td><a href="redivis/redivis.current_notebook"><strong><code>redivis.datasource</code></strong></a>(source)</td><td>Construct a new <a href="datasource">Datasource</a> instance. Can only be called if a <a href="..#environment-variables">default workflow is set</a>. Otherwise, use the <a href="workflow/workflow.datasource">workflow.datasource()</a> constructor.</td></tr><tr><td><a href="redivis/redivis.make_api_request"><strong><code>redivis.make_api_request</code></strong></a>(*, [method, path, ...])</td><td>Call the Redivis API directly (for advanced use cases).</td></tr><tr><td><a href="redivis/redivis.notebook"><strong><code>redivis.notebook</code></strong></a>(name)</td><td>Construct a new <a href="notebook">Notebook</a> instance.</td></tr><tr><td><a href="redivis/redivis.organization"><strong><code>redivis.organization</code></strong></a>(name)</td><td>Construct a new <a href="organization">Organization</a> instance.</td></tr><tr><td><a href="redivis/redivis.parameter"><strong><code>redivis.parameter</code></strong></a>(name)</td><td>Construct a new <a href="parameter">Parameter</a> instance</td></tr><tr><td><a href="redivis/redivis.query"><strong><code>redivis.query</code></strong></a>(query)</td><td>Execute a SQL query, returning a <a href="query">Query</a> instance.</td></tr><tr><td><a href="redivis/redivis.table"><strong><code>redivis.table</code></strong></a>(name)</td><td>Construct a new <a href="table">Table</a> instance.</td></tr><tr><td><a href="redivis/redivis.transform"><strong><code>redivis.transform</code></strong></a>(name)</td><td>Construct a new <a href="transform">Transform</a> instance.</td></tr><tr><td><a href="redivis/redivis.user"><strong><code>redivis.user</code></strong></a>(name)</td><td>Construct a new <a href="user">User</a> instance.</td></tr></tbody></table>

## Exceptions

All exceptions raised by Redivis will be of class `redivis.exceptions.RedivisError` . Subclasses of RedivisError can be used to handle errors around specific events. See [redivis.exceptions](https://docs.redivis.com/api/client-libraries/redivis-python/reference/redivis/redivis.exceptions) for full details.

## Examples

```python
import redivis

organization = redivis.organization("Demo")
# organization.list_datasets(), organization.dataset("Iris species"), etc...

dataset = organization.dataset("iris_species")
table = dataset.table("iris")  
# table.to_pandas_dataframe(), etc...
# In a notebook, can do redivis.table("_source_") to reference the source table

query = redivis.query("""
    SELECT * 
    FROM demo.iris_species.iris 
    WHERE SepalLengthCm > 5
""")
# query.to_pandas_dataframe(), etc...
```
