# Workflow

## *class* <mark style="color:purple;">Workflow</mark>

Workflows on Redivis are where analytical pipelines are built and executed. All workflows are owned by a user, and are made up of datasources, transforms, notebooks, and tables.

{% hint style="warning" %}
Workflows were previously referred to as "Projects" on Redivis. Existing code that utilized the "project" terminology will continue to work (e.g., `User.list_projects()`).&#x20;

However, we encourage users to migrate their code to prevent future issues and confusion.
{% endhint %}

## Constructors

<table><thead><tr><th width="367">Method</th><th>Description</th></tr></thead><tbody><tr><td><a href="/pages/1tvwBeyqBtUmkUgjkrRu"><strong><code>redivis.current_workflow</code></strong></a>()</td><td>Get the current default workflow. Typically called within notebooks.</td></tr><tr><td><a href="/pages/TWihJd93cXIMG5gFpqxj"><strong><code>Organization.list_workflows</code></strong></a>([max_results])</td><td>List all workflows owned by an organization.</td></tr><tr><td><a href="/pages/TWihJd93cXIMG5gFpqxj"><strong><code>Organization.workflow</code></strong></a>(name)</td><td>Construct a new workflow instance that references a workflow owned by an organization.</td></tr><tr><td><a href="/pages/TWihJd93cXIMG5gFpqxj"><strong><code>User.list_workflows</code></strong></a>([max_results])</td><td>List all workflows owned by a user.</td></tr><tr><td><a href="/pages/TWihJd93cXIMG5gFpqxj"><strong><code>User.workflow</code></strong></a>(name)</td><td>Construct a new workflow instance that references a workflow owned by a user.</td></tr></tbody></table>

## Examples

{% tabs %}
{% tab title="Basics" %}

<pre class="language-python"><code class="lang-python">workflow = redivis.user("imathews").workflow("example_workflow_climate_analysis")
tables = workflow.list_tables()

for table in tables:
<strong>    # Properties will be populated with the table.list resource representation
</strong>    print(table.properties) 
    
    table.get()
    # Properties will now be populated with the table.get resource representation
    print(table.properties) 

workflow.table("join_lat_lon_output").exists() # -> TRUE
</code></pre>

{% endtab %}

{% tab title="Scoped queries" %}

```python
workflow = redivis.user("imathews").workflow("example_workflow_climate_analysis")

query = workflow.query("""
    SELECT
        id,
        EXTRACT(YEAR FROM date) AS year,
        SUM(value) AS annual_precip
    FROM daily_observations
    WHERE (element = 'PRCP')
    GROUP BY id, year
""")

query.to_pandas_dataframe()
# 	id	        year	    annual_precip
# 0	CA0023026HN	2003	    2925.0
# ...
```

{% endtab %}
{% endtabs %}

## Attributes

| **`properties`**          | <p>A dict containing the <a href="/pages/tdGF9MCxwWhySoWzAc4I">API resource representation of the workflow</a>. <br><br>This will be fully populated after calling <a href="/pages/snnHK7KpMBV5HfxHqaUV">Workflow\.get()</a>, and partially populated for workflows created via <a href="/pages/AtiJlauU9Lkil3BLqYIZ">User.list\_workflows</a>. Otherwise will be <code>None</code>.</p> |
| ------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **`qualified_reference`** | The [fully qualified reference](/api/referencing-resources.md) for the workflow, which can be used in SQL queries or the REST API. E.g., `imathews.example_`workflow`_climate_analysis:x7kh`                                                                                                                                                                                             |
| **`scoped_reference`**    | The canonical reference for the workflow, without the username qualifier. E.g.,: `example_`workflow`_climate_analysis:x7kh`                                                                                                                                                                                                                                                              |
| **`user`**                | A reference to the [User](/api/client-libraries/redivis-python/reference/user.md) instance that constructed this workflow.                                                                                                                                                                                                                                                               |
| **`organization`**        | A reference to the [Organization](/api/client-libraries/redivis-python/reference/organization.md) instance that constructed this workflow.                                                                                                                                                                                                                                               |

## Methods

<table data-header-hidden><thead><tr><th width="441"></th><th></th></tr></thead><tbody><tr><td><a href="/pages/bcpCwD9uRgWqMXcMQbR7"><strong><code>Workflow.datasource</code></strong></a>()</td><td>Create a reference to a datasource within the workflow.</td></tr><tr><td><a href="/pages/DR12rFPrDgRvklBLcRtT"><strong><code>Workflow.exists</code></strong></a>()</td><td>Check whether the workflow exists.</td></tr><tr><td><a href="/pages/snnHK7KpMBV5HfxHqaUV"><strong><code>Workflow.get</code></strong></a>()</td><td>Get the workflow, populating the <code>properties</code> attribute on the current instance.</td></tr><tr><td><a href="/pages/s9k4NKeV70hieAKeLWaU"><strong><code>Workflow.list_datasources</code></strong></a>([max_results])</td><td>List all datasources in the workflow.</td></tr><tr><td><a href="/pages/sZLDUnBl8lxc106OH1oO"><strong><code>Workflow.list_notebooks</code></strong></a>([max_results])</td><td>List all notebooks in the workflow.</td></tr><tr><td><a href="/pages/0HRPgeQhKVhnMsf1a7Ac"><strong><code>Workflow.list_parameters</code></strong></a>([max_results])</td><td>List all parameters in the workflow</td></tr><tr><td><a href="/pages/AT35k3elPckxwxZmlqSd"><strong><code>Workflow.list_tables</code></strong></a>([max_results])</td><td>List all tables in the workflow.</td></tr><tr><td><a href="/pages/Dy5Q11mnJsbF25p6WZed"><strong><code>Workflow.list_transforms</code></strong></a>([max_results])</td><td>List all transforms in the workflow.</td></tr><tr><td><a href="/pages/rnm6p1HKwFzPovNrK15R"><strong><code>Workflow.notebook</code></strong></a>(name)</td><td>Create a reference to a specific notebook within the workflow.</td></tr><tr><td><a href="/pages/MpecLWxGHi02bQxx9NqU"><strong><code>Workflow.parameter</code></strong></a>(name)</td><td>Create a reference to a specific parameter within the workflow.</td></tr><tr><td><a href="/pages/8NWPTksnMlbWw68Dtnva"><strong><code>Workflow.query</code></strong></a>(query_string)</td><td>Create a query scoped to the workflow.</td></tr><tr><td><a href="/pages/lDprIMnf7L8Z0SFY0Rv8"><strong><code>Workflow.table</code></strong></a>(name)</td><td>Create a reference to a specific table within the workflow.</td></tr><tr><td><a href="/pages/Sn6g6dUrHeJCs6tG65De"><strong><code>Workflow.transform</code></strong></a>(name)</td><td>Create a reference to a specific transform within the workflow.</td></tr><tr><td><a href="/pages/DL3ocVH5tfOTZ9EArLyk"><strong><code>Workflow.update_variables</code></strong></a>(variables)</td><td>Batch update variable metadata across tables in a workflow.</td></tr></tbody></table>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.redivis.com/api/client-libraries/redivis-python/reference/workflow.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
