> ## Documentation Index
> Fetch the complete documentation index at: https://agno-v2.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# CSV Row Chunking

> Split CSV files into one chunk per row with RowChunking.

`CSVReader` parses the records, then `RowChunking` creates one chunk for each non-empty normalized row and records its logical row number in metadata.

**1. Create a Python file**

```python csv_row_chunking.py theme={null}
from agno.agent import Agent
from agno.knowledge.chunking.row import RowChunking
from agno.knowledge.knowledge import Knowledge
from agno.knowledge.reader.csv_reader import CSVReader
from agno.vectordb.pgvector import PgVector

db_url = "postgresql+psycopg://ai:ai@localhost:5532/ai"

knowledge_base = Knowledge(
    vector_db=PgVector(table_name="imdb_movies_row_chunking", db_url=db_url),
)

knowledge_base.insert(
    url="https://agno-public.s3.amazonaws.com/demo_data/IMDB-Movie-Data.csv",
    reader=CSVReader(
        chunking_strategy=RowChunking(),
    ),
)

agent = Agent(
    knowledge=knowledge_base,
    search_knowledge=True,
)

agent.print_response("Tell me about the movie Guardians of the Galaxy", markdown=True)
```

<Snippet file="create-venv-step.mdx" />

**2. Install dependencies**

```bash theme={null}
uv pip install -U agno sqlalchemy psycopg pgvector aiofiles openai
```

**3. Export your OpenAI API key**

<Snippet file="set-openai-key.mdx" />

<Snippet file="run-pgvector-step.mdx" />

**4. Run the script**

```bash theme={null}
python csv_row_chunking.py
```

## CSV Row Chunking Params

<Snippet file="chunking-csv-row.mdx" />

## Developer Resources

* [Chunking overview](https://agno-v2.mintlify.site/knowledge/concepts/chunking/overview.md)
* [Chunking strategies examples](https://agno-v2.mintlify.site/examples/knowledge/building-blocks/chunking-strategies.md)
* [CSV reader](https://agno-v2.mintlify.site/knowledge/concepts/readers/csv-reader.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.