> For the complete documentation index, see [llms.txt](https://docs.redivis.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.redivis.com/guides/analyze-data-in-a-workflow/switch-data-sources.md).

# Switch data sources

When creating a workflow, you may want to start with a data source that is convenient for development and later switch to the data you ultimately want to analyze. For example, you might build an analysis using a small sample, switch to a new version of a dataset, or develop using synthetic data before running your workflow on restricted data.&#x20;

The steps for switching data sources depend in how the data is represented in your workflow.

## 1. Open your workflow

[Open the workflow](/guides/analyze-data-in-a-workflow.md) containing the data you want to change and navigate to the data source node in the workflow tree. From here, you can choose how you'd like to change the data used in your workflow.

<div data-with-frame="true"><figure><img src="https://1672950126-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LVodLwUXgJUGcm5Cvso%2Fuploads%2FYAkpUymaA7OL8oNoRmrn%2Fredivis.com_workflows_xejr-bbr69adsr_dataSources_xv6h-dyemx2bjd%20(1).png?alt=media&amp;token=ff7a3035-da31-4cc9-99cd-296eceb1ac17" alt=""><figcaption></figcaption></figure></div>

## 2. Switch the data source

Depending on what you are trying to accomplish, there are several ways you can switch the data source:

### Switch to a different version

Changing [versions](/reference/datasets/versions.md) can be useful when a dataset has been updated and you want to rerun your existing analysis using the newest version, or when you want to reproduce an analysis using a specific version. Redivis will indicate when a new version is released.

To run your workflow using a different version of the same dataset, select the version number next to the dataset title.

<div data-with-frame="true"><figure><img src="https://1672950126-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LVodLwUXgJUGcm5Cvso%2Fuploads%2FVhypK5MXvHIfT5L2zMNq%2Fredivis.com_workflows_xejr-bbr69adsr_dataSources_xv6h-dyemx2bjd%20(2).png?alt=media&amp;token=8f48aa03-b111-4faa-98f2-4747298809ef" alt=""><figcaption></figcaption></figure></div>

Alternatively, you may select **Version** in the top resource bar.

<div data-with-frame="true"><figure><img src="https://1672950126-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LVodLwUXgJUGcm5Cvso%2Fuploads%2FZBE7t5eZo9sAPKDzaoa8%2Fredivis.com_workflows_xejr-bbr69adsr_dataSources_xv6h-dyemx2bjd%20(18).png?alt=media&amp;token=ef41d79c-9512-4825-aaf6-5ed4cfe4daa0" alt=""><figcaption></figcaption></figure></div>

You can navigate between different versions of the dataset and review the changes to each version. You'll want to check that the version you are switching to contains the tables and variables your workflow expects. If the schema has changed, you may need to update your workflow before running it.

<div data-with-frame="true"><figure><img src="https://1672950126-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LVodLwUXgJUGcm5Cvso%2Fuploads%2FzIS0OUFFNYaWe5FGXuJP%2Fredivis.com_workflows_xejr-bbr69adsr_dataSources_xv6h-dyemx2bjd%20(8).png?alt=media&amp;token=89b615fd-9e40-4b78-9e1b-a9753644128e" alt=""><figcaption></figcaption></figure></div>

After making necessary updates, rerun the workflow to apply the changes and materialize the updated results.

### Switch from a sample to the full dataset

When you create a workflow with data that has a [sample configured](/reference/workflows/data-sources.md), Redivis will use the sample by default. If you have been developing your workflow using a sample, you can switch to the full dataset when you're ready to run you analysis on all of the available data.

In addition, access to a sample does not necessarily grant access to the full dataset. A dataset owner may configure different access rules for sample and the full dataset. If you do not have access to the full dataset, you'll need to [apply for access](/guides/discover-and-access-data/apply-to-access-restricted-data.md) before you can switch to it.

To switch from a sample to the full dataset, select the 1% sample next to the dataset version, beside the dataset title.

<div data-with-frame="true"><figure><img src="https://1672950126-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LVodLwUXgJUGcm5Cvso%2Fuploads%2Fu6AaLr0n1pP2LlydOKvW%2Fredivis.com_workflows_xejr-bbr69adsr_dataSources_xv6h-dyemx2bjd%20(10).png?alt=media&amp;token=54338c3f-972d-4a55-a466-3bc47a24158f" alt=""><figcaption></figcaption></figure></div>

Alternatively, you may select **Sampling** in the top resource bar.

<div data-with-frame="true"><figure><img src="https://1672950126-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LVodLwUXgJUGcm5Cvso%2Fuploads%2FgSure9g9NsgspmjoP0ZR%2Fredivis.com_workflows_xejr-bbr69adsr_dataSources_xv6h-dyemx2bjd%20(12).png?alt=media&amp;token=7de7403e-b36b-47e7-b0b2-d194a29f46ab" alt=""><figcaption></figcaption></figure></div>

Here, you can move between the sample and full dataset.

<div data-with-frame="true"><figure><img src="https://1672950126-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LVodLwUXgJUGcm5Cvso%2Fuploads%2FsEa5XXNQLjNn31dsa9nV%2Fredivis.com_workflows_xejr-bbr69adsr_dataSources_xv6h-dyemx2bjd%20(13).png?alt=media&amp;token=9c798a2e-4e35-441e-bf92-4ecc21a552f6" alt=""><figcaption></figcaption></figure></div>

{% hint style="info" %}
For exceptionally large datasets, you may want to develop your workflow using a sample, even if you have access to the full dataset. Redivis is designed to support fast computation even on large datasets, but working with a sample can further improve computation speed and allow you to iterate more quickly while developing your analysis. Switch to the full dataset once your workflow is ready for the final analysis.
{% endhint %}

### Replace with a different data source

You can also replace a data source with an entirely [different dataset](/reference/workflows/data-sources.md#datasets-as-a-data-source). This can be useful when you develop a workflow using one dataset and want to run it on another dataset with a compatible structure.

For example, you might:

* **Work with high risk data:** Develop and test a workflow using a [synthetic version](/guides/analyze-data-in-a-workflow/example-workflows/using-synthetic-data.md) of a dataset, then switch to the real dataset for the final analysis. An administrator can also run the workflow on the restricted dataset and provide the results to the researcher without granting access to the underlying data.
* **Work with standardized data models:** Develop a workflow using one dataset that follows a standardized data model, such as OMOP, and apply it to another dataset using the same model.

To replace the dataset, open the **More** menu in the resource bar, and select **Replace dataset**.

<div data-with-frame="true"><figure><img src="https://1672950126-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LVodLwUXgJUGcm5Cvso%2Fuploads%2FFYokm02a2aqTzIKUYQsQ%2Fredivis.com_workflows_xejr-bbr69adsr_dataSources_xv6h-dyemx2bjd%20(15).png?alt=media&amp;token=dda22b70-05e3-4f70-8fa3-acfcdc3116b4" alt=""><figcaption></figcaption></figure></div>

Search for the dataset you would like to replace it with. If you do not have data access to the new dataset, you will be unable to view its restricted tables and will need to apply for access to see and use them in your workflow.

<div data-with-frame="true"><figure><img src="https://1672950126-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LVodLwUXgJUGcm5Cvso%2Fuploads%2FyY72kLBTLaX7Nqda65uS%2Fredivis.com_workflows_xejr-bbr69adsr_dataSources_xv6h-dyemx2bjd%20(16).png?alt=media&amp;token=cfb9635d-75f6-4689-ab1b-3d26c8ff1165" alt=""><figcaption></figcaption></figure></div>

Then align the workflow's tables to the corresponding tables in the new dataset. This updates the workflow to use the new data while preserving the transforms and analyses you've already created.

<div data-with-frame="true"><figure><img src="https://1672950126-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LVodLwUXgJUGcm5Cvso%2Fuploads%2FoHrBx37uTOLEdJYfxnYH%2Fredivis.com_workflows_xejr-bbr69adsr_dataSources_xv6h-dyemx2bjd%20(17).png?alt=media&amp;token=a3cc544f-b8ac-4750-9544-5dd1da4ebf2f" alt=""><figcaption></figcaption></figure></div>

## 3. Verify your workflow

Downstream nodes will be [stale](/reference/workflows/create-and-edit-workflows.md#stale-nodes) to indicate that an upstream change has been made. After switching the data source, review your workflow to make sure the new data is being used as expected.

In particular, check that:

* The expected tables are available.
* The variables used by your workflow are available.
* Variable names and data types are compatible.
* Any filters or other assumptions in your workflow still apply.

## 4. Run your workflow

Once you've verified the new data source, [run your workflow](/reference/workflows/create-and-edit-workflows.md#run-all) to update its outputs. To update all nodes at once, select **Run all stale nodes** from the workflow's **Map** menu.

<figure><img src="https://1672950126-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LVodLwUXgJUGcm5Cvso%2Fuploads%2FojUZU8Ive9qrRNCN1t7k%2Fredivis.com_workflows_py4r-6zdfdx1yp_transforms_j9g5-atgmazwc1%20(2).png?alt=media&amp;token=bf5929d3-48e4-405a-bf01-22c24fefb9bc" alt=""><figcaption></figcaption></figure>

&#x20;Always check that the resulting output looks as expected!

## Next steps

#### Share and collaborate

All Redivis notebooks support real-time collaboration, allowing multiple editors to edit and run cells in a running notebook. When another editor is active in a notebook, you will see a colored cursor associated with them, similar to a Google Doc.

[Share your workflow](/reference/workflows/overview.md#managing-a-project) to work with collaborators in real time and make it public so that others can fork and build upon your work.

#### Cite datasets in your publications

If the work you're doing leads to a publication, check for proper [citation information](/redivis-for-open-science/citations.md) on the reference pages of the datasets used in your workflow.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.redivis.com/guides/analyze-data-in-a-workflow/switch-data-sources.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
