Skip to main content

Convert a Claude.ai export to SQLite

Project description

claude-to-sqlite

PyPI Changelog Tests License

Convert a Claude.ai export to SQLite

Installation

Install this tool using pip:

pip install claude-to-sqlite

Usage

Start 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.db

Now claude.db will be a SQLite containing the conversations and messages from your Claude export.

You can explore that using Datasette:

datasette claude.db

Database schema

Assuming the Claude export JSON has not changed since this tool was last released on 20th October 2024 the database tables should look like this:

CREATE TABLE [conversations] (
   [uuid] TEXT PRIMARY KEY,
   [name] TEXT,
   [created_at] TEXT,
   [updated_at] TEXT,
   [account_id] TEXT
);
CREATE TABLE [messages] (
   [uuid] TEXT PRIMARY KEY,
   [text] TEXT,
   [sender] TEXT,
   [created_at] TEXT,
   [updated_at] TEXT,
   [attachments] TEXT,
   [files] TEXT,
   [conversation_id] TEXT REFERENCES [conversations]([uuid])
);
CREATE TABLE [artifacts] (
   [id] TEXT PRIMARY KEY,
   [artifact] TEXT,
   [identifier] TEXT,
   [version] INTEGER,
   [type] TEXT,
   [language] TEXT,
   [title] TEXT,
   [content] TEXT,
   [thinking] TEXT,
   [conversation_id] TEXT REFERENCES [conversations]([uuid]),
   [message_id] TEXT REFERENCES [messages]([uuid])
);

Development

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/activate

Now install the dependencies and test dependencies:

pip install -e '.[test]'

To run the tests:

python -m pytest

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

claude_to_sqlite-0.2.tar.gz (9.4 kB view details)

Uploaded Source

Built Distribution

claude_to_sqlite-0.2-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

Details for the file claude_to_sqlite-0.2.tar.gz.

File metadata

  • Download URL: claude_to_sqlite-0.2.tar.gz
  • Upload date:
  • Size: 9.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for claude_to_sqlite-0.2.tar.gz
Algorithm Hash digest
SHA256 98927612aea38c40d93368d2cd54b32e11b24fe93eb8550c9e6ec031d1134c5e
MD5 ba5a53896d23a9e46148aa7447c7ce3c
BLAKE2b-256 aae153799e8f3240ff08d6aa8cf1c86f4322148dc6dc0bc3b7776f8c82695291

See more details on using hashes here.

File details

Details for the file claude_to_sqlite-0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for claude_to_sqlite-0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 75440f745f47bfec96b84f23413a701a69c87ac35de205bfc8680b1869abde96
MD5 87bf77bbe944891c52e407ee24104e5f
BLAKE2b-256 aa6578270e19a9454730b27373b1a19f5e86524d3a9e4b3ed06cdb5ca17264b2

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page