Convert a Claude.ai export to SQLite
Install this tool using pip:
pip install claude-to-sqliteStart by exporting your Claude data. You will be emailed a link to a zip file (though it may be missing the .zip extension).
Run the command like this:
claude-to-sqlite claude-export.zip claude.dbNow claude.db will be a SQLite database containing the memories, conversations, messages, attachments, and artifacts from your Claude export.
You can explore that using Datasette:
datasette claude.dbThe database contains the following tables:
Claude's accumulated memory/context about you.
| Column | Type | Description |
|---|---|---|
| account_uuid | TEXT PRIMARY KEY | Account UUID |
| conversations_memory | TEXT | Claude's memory about your preferences, context, etc. |
Conversation metadata.
| Column | Type | Description |
|---|---|---|
| uuid | TEXT PRIMARY KEY | Conversation UUID |
| name | TEXT | Conversation title |
| summary | TEXT | Conversation summary |
| created_at | TEXT | ISO timestamp |
| updated_at | TEXT | ISO timestamp |
| account_id | TEXT | Account UUID |
Individual chat messages.
| Column | Type | Description |
|---|---|---|
| uuid | TEXT PRIMARY KEY | Message UUID |
| text | TEXT | Message content |
| sender | TEXT | Either 'human' or 'assistant' |
| created_at | TEXT | ISO timestamp |
| updated_at | TEXT | ISO timestamp |
| conversation_id | TEXT | Links to conversations.uuid |
Files attached to messages with extracted content.
| Column | Type | Description |
|---|---|---|
| message_uuid | TEXT | Links to messages.uuid |
| file_name | TEXT | Original filename |
| file_size | INTEGER | Size in bytes |
| file_type | TEXT | MIME type |
| extracted_content | TEXT | Text extracted from the file |
Code blocks and other artifacts from assistant messages.
| Column | Type | Description |
|---|---|---|
| id | TEXT PRIMARY KEY | Artifact ID with version |
| artifact | TEXT | Base artifact identifier |
| identifier | TEXT | Artifact identifier from tag |
| version | INTEGER | Version number |
| type | TEXT | Artifact type |
| language | TEXT | Programming language |
| title | TEXT | Artifact title |
| content | TEXT | Artifact content |
| thinking | TEXT | Associated thinking content |
| conversation_id | TEXT | Links to conversations.uuid |
| message_id | TEXT | Links to messages.uuid |
To contribute to this tool, first checkout the code. Then create a new virtual environment:
cd claude-to-sqlite
python -m venv venv
source venv/bin/activateNow install the dependencies and test dependencies:
pip install -e '.[test]'To run the tests:
python -m pytest