---
title: "Declarative AI Infrastructure: Define Pipelines, Not Plumbing"
description: "Replace thousands of lines of orchestration code with declarative computed columns. Pixeltable handles execution, dependencies, stored results, and incremental updates automatically."
keywords:
  - declarative ai data infrastructure
  - declarative data processing
  - ai pipeline automation
  - declarative ai pipelines
  - reduce infrastructure code
complexity: "beginner"
estimated_time: "15 min"
url: "https://www.pixeltable.com/use-cases/declarative-ai-data-infrastructure"
---

# Declarative AI Infrastructure: Define Pipelines, Not Plumbing

Replace thousands of lines of orchestration code with declarative computed columns. Pixeltable handles execution, dependencies, stored results, and incremental updates automatically.

## Prerequisites

- Basic Python programming
- Understanding of AI workflows

## The Problem

Traditional AI infrastructure requires imperative orchestration: loading data, managing state, scheduling jobs, handling retries, tracking dependencies. This code is brittle, hard to test, and grows faster than the actual application logic.

## The Solution

Pixeltable's declarative model lets you define what to compute, not how. Computed columns express your pipeline logic. The engine handles execution order, dependency tracking, incremental updates, stored results, and error recovery.

## Implementation

### Declarative Columns

Express your entire pipeline as computed columns, no orchestrator needed.

```python
import pixeltable as pxt
from pixeltable.functions import openai

# Define what you want, not how to get it
images = pxt.create_table('app.images', {
    'image': pxt.Image,
    'title': pxt.String,
})

# AI inference as a computed column
images.add_computed_column(
    description=openai.chat_completions(
        model='gpt-4o-mini',
        messages=[{
            'role': 'user',
            'content': [images.image, 'Describe this image.']
        }]
    ).choices[0].message.content
)

# Dependent columns run in correct order automatically
images.add_computed_column(
    tags=openai.chat_completions(
        model='gpt-4o-mini',
        messages=[{
            'role': 'user',
            'content': 'Extract 5 tags from: ' + images.description.astype(pxt.String)
        }]
    ).choices[0].message.content
)
```

Pixeltable tracks dependencies between columns and executes them in the right order. No DAG configuration files.


### Incremental Processing

Only changed data triggers recomputation, saving compute and money.

```python
# Insert 1000 images: all are processed
images.insert([...image_batch])  # Processes 1000 images

# Add 1 more: only the new one is processed
images.insert([{'image': 'new.jpg', 'title': 'Latest'}])
# ✅ Only 1 image processed, not 1001

# Add a new computed column: processes all existing rows
images.add_computed_column(
    sentiment=openai.chat_completions(
        model='gpt-4o-mini',
        messages=[{
            'role': 'user',
            'content': 'Sentiment of: ' + images.description.astype(pxt.String)
        }]
    ).choices[0].message.content
)
# Processes 1001 rows for the new column only
# description and tags are NOT recomputed
```

Adding a row computes only that row, and adding a column computes only that column.


## Benefits

- Less infrastructure code to maintain
- Automatic dependency tracking and execution ordering
- Incremental updates: new and updated rows compute only themselves
- Stored results, error handling, and retry logic
- Full data lineage and versioning

## Use Cases

- ML model training data pipelines
- Automated data enrichment workflows
- AI application backends
- Research experimentation platforms

## Requirements

- Python 3.9+
- API keys for AI providers

## Resources

- [Declarative AI Pipelines: Open Standard](https://www.pixeltable.com/blog/declarative-ai-pipelines-open-standard) - Why we built Pixeltable open source
- [Dependency Graph Magic](https://www.pixeltable.com/blog/dependency-graph-magic-computed-columns) - How computed columns maintain data consistency

## How-to guides

- [How do I build an AI data pipeline in Python?](https://www.pixeltable.com/learn/how-to/build-an-ai-data-pipeline)
- [How do I replace an Airflow DAG and a vector database with one schema?](https://www.pixeltable.com/learn/how-to/migrate-from-airflow-and-a-vector-database)

