# Version

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

All datasets on Redivis are versioned. This interface allows you to view detailed information about the version history of a dataset and manage historic versions. However, if you want to get a dataset's contents at a particular version, construct the dataset with the version tag; e.g. `user|organization.dataset(name, version="1.0")`.

## Constructors

<table data-header-hidden><thead><tr><th width="439">Method</th><th>Description</th></tr></thead><tbody><tr><td><a href="/pages/sbo9deQXFzEyeAUTXa8a"><strong><code>Dataset.list_versions</code></strong></a>([max_results])</td><td>Returns the list of all versions of a dataset.</td></tr><tr><td><a href="/pages/aNkMQOdLbQLCsCqTLj7X"><strong><code>Dataset.version</code></strong></a>(tag)</td><td>Construct a new version instance based on a specific version tag (e.g., <code>tag=1.0</code>)</td></tr></tbody></table>

## Examples

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

```python
my_org = redivis.organization("some_organization")
dataset = my_org.dataset("some_dataset")
current_version = dataset.version("1.0")

current_version.exists() # True

# Get the full API representation of the version and print its properties
print(current_version.get().properties)

for version in dataset.list_versions():
    print(version.properties)
```

{% endtab %}

{% tab title="Jump between versions" %}

```python
my_org = redivis.organization("some_organization")
dataset = my_org.dataset("some_dataset")
current_version = dataset.version("current")

# can also call version.next_version() to go the other direction
previous_version = current_version.previous_version()
if previous_version is not None:
    print(previous_version["tag"])
```

{% endtab %}

{% tab title="Delete a historic version" %}

```python
my_org = redivis.organization("some_organization")
dataset = my_org.dataset("some_dataset")
historic_version = dataset.version("1.0")

# Delete the data in this version, potentially saving storage costs
# Note that users will no longer be able to query or export data in this version!
historic_version.delete()
```

{% endtab %}
{% endtabs %}

## Attributes

| **`properties`** | <p>A dict containing the <a href="/pages/-LztgVCAybNSHGXjaTBT">API resource representation of the version</a>. This will be fully populated after calling <a href="/pages/0TZzRcLt1lP7iZpxgUkY">get()</a>.<br><br>This will also be partially populated for versions returned via the <a href="/pages/sbo9deQXFzEyeAUTXa8a">Dataset.list\_versions</a> method.</p> |
| ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |

## Methods

<table data-header-hidden><thead><tr><th width="450"></th><th></th></tr></thead><tbody><tr><td><a href="/pages/nn58BGVeArCj7l8yHfAS"><strong><code>Version.dataset</code></strong></a>()</td><td>Create a new dataset reference representing this particular version.</td></tr><tr><td><a href="/pages/Hu9aKnUXYz3feOlIwemO"><strong><code>Version.delete</code></strong></a>()</td><td>Delete an unreleased version, or mark an historic version as deleted.</td></tr><tr><td><a href="/pages/maeF3ptoTeabndSXclZu"><strong><code>Version.exists</code></strong></a>()</td><td>Check whether the version exists.</td></tr><tr><td><a href="/pages/0TZzRcLt1lP7iZpxgUkY"><strong><code>Version.get</code></strong></a>()</td><td>Fetch the version, populating the <code>properties</code> attribute on the current instance.</td></tr><tr><td><a href="/pages/XdTGJj1PuFbJ792WNX6c"><strong><code>Version.next_version</code></strong></a>()</td><td>Return the version immediately after this version. If no next version exists, will return <code>None</code>.</td></tr><tr><td><a href="/pages/c9HR6MtFD94LXPIzokGX"><strong><code>Version.previous_version</code></strong></a>()</td><td>Return the version immediately before this version. If no previous version exists, will return <code>None</code>.</td></tr><tr><td><a href="/pages/jyjpucejgxnyhELxiEW8"><strong><code>Version.undelete</code></strong></a>()</td><td>Undeletes a deleted version.</td></tr><tr><td><a href="/pages/cZNIyH1qrDqNnzcraN9w"><strong><code>Version.update</code></strong></a>()</td><td>Update properties on a version.</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/version.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.
