Skip to main content

Import ChatGPT conversations into a SQLite database

Project description

chatgpt-to-sqlite

PyPI Changelog Tests License

Import ChatGPT conversations into a SQLite database

Installation

Install this tool using pip:

pip install chatgpt-to-sqlite

Usage

Pre-Requisite:

Open ChatGPT and navigate to your account settings.

Click "Data Controls and then "Export" under "Export data".

For help, run:

chatgpt-to-sqlite --help

You can also use:

python -m chatgpt_to_sqlite --help

Export ChatGPT data into a SQLite Data:

chatgpt-to-sqlite path/to/chatGPT_conversations.json chatgpt.db

Database Schema:

CREATE TABLE [conversations] (
    [chat_id] TEXT PRIMARY KEY,
    [title] TEXT,
    [create_time] TEXT,
    [update_time] TEXT
);
CREATE TABLE "messages" (
    [message_id] TEXT PRIMARY KEY,
    [sender] TEXT,
    [create_time] TEXT,
    [status] TEXT,
    [weight] FLOAT,
    [text] TEXT,
    [model] TEXT,
    [chat_id] TEXT REFERENCES [conversations]([chat_id])
);

Development

To contribute to this tool, first checkout the code. Then create a new virtual environment:

cd chatgpt-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:

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

chatgpt-to-sqlite-0.1.0.tar.gz (7.9 kB view hashes)

Uploaded Source

Built Distribution

chatgpt_to_sqlite-0.1.0-py3-none-any.whl (8.8 kB view hashes)

Uploaded Python 3

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