---
title: "Dataset.get_or_create_collection"
description: "Get a collection by its name. If the collection does not exist, it will be created."
image: "https://tilebox.com/images/tilebox-docs-social-preview.png"
---

> Documentation Index
> Fetch the complete documentation index at: https://tilebox.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Dataset.get_or_create_collection

import { Fragment } from "astro/jsx-runtime";

import ApiReference from "@docs/components/ApiReference.astro";

import ParamField from "@docs/components/ParamField.astro";

```python
def Dataset.get_or_create_collection(name: str) -> Collection
```

Get a collection by its name. If the collection does not exist, it will be created.

## Parameters

**name**

type: string

The name of the collection

## Returns

A collection object.

<h2 id="request-example">Usage example</h2>

```python
collection = dataset.get_or_create_collection(
    "My-collection"
)
```

Source: https://tilebox.com/docs/api-reference/python/tilebox.datasets/Dataset.get_or_create_collection/index.mdx
