> 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/api/client-libraries/redivis-js/reference/datasource/datasource.update.md).

# Datasource.update

### Datasource.<mark style="color:purple;">update</mark>(*{ sourceDataset, sourceWorkflow, sample, version, mappedTables }*) → `Promise<Datasource>`

Changes the datasource's source, its version or sample, or how its tables are mapped to those of a new source. Only the options that are provided are changed.

**Parameters:**

**`sourceDataset`** : *Dataset | string, optional*\
A new source dataset.

**`sourceWorkflow`** : *Workflow | string, optional*\
A new source workflow.

**`sample`** : *boolean, optional*\
Whether to use the source dataset's sample.

**`version`** : *Version | string, optional*\
The version of the source dataset to use (e.g., `v1_0`, or `current` to always use the latest version).

**`mappedTables`** : *Array | object, optional*\
When the new source's tables have different names, how the current tables map to them: an array of `[sourceTable, destinationTable]` pairs (as [Tables](https://docs.redivis.com/api/client-libraries/redivis-js/reference/table.md) or names), or an object of names.

**Returns:** `Promise<Datasource>`, this datasource.


---

# 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/api/client-libraries/redivis-js/reference/datasource/datasource.update.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.
