---
title: "Add unique identifiers to your tables"
description: "Generate UUIDs for automatic row identification."
url: "https://www.pixeltable.com/notebooks/workflow-uuid-identity"
updated: "2026-04-10"
---

# Add unique identifiers to your tables

Generate UUIDs for automatic row identification.

- **Type:** Notebook
- **Group:** Core Operations

## How it works

You use uuid7() to generate UUIDs for each row. Define it in the schema with {'column_name': uuid7()} syntax, or add it to existing tables with add_computed_column().

## What it covers

- Create tables with auto-generated UUID primary keys
- Add UUID columns to existing tables
- Generate UUIDs with uuid7()

## What it uses

- **Install:** `pip install pixeltable`
- **Pixeltable calls:** `uuid.uuid7()`, `pxt.create_table()`, `insert()`, `add_computed_column()`

## A look at the code

```python
# Create table with auto-generated UUID primary key
products = pxt.create_table(
    'uuid_demo/products',
    {
        'id': uuid7(),  # Auto-generates UUID for each row
        'name': pxt.String,
        'price': pxt.Float,
    },
    primary_key=['id'],
)
```

## Open it

- **Open in Colab:** https://colab.research.google.com/github/pixeltable/pixeltable/blob/release/docs/release/howto/cookbooks/core/workflow-uuid-identity.ipynb
- **Docs page:** https://docs.pixeltable.com/howto/cookbooks/core/workflow-uuid-identity
- **Source on GitHub:** https://github.com/pixeltable/pixeltable/blob/release/docs/release/howto/cookbooks/core/workflow-uuid-identity.ipynb
