LLM helper for psql
Project description
gptsql
An LLM wrapper around your database connection. Think of it as a "smart" version of the psql cli.
Example:
python -m gptsql
> show me the schemas
thinking...
Running select query: SELECT schema_name FROM information_schema.schemata;
processing the function response...
Here are the schemas in your database:
1. pg_catalog
2. information_schema
3. analytics
4. public
5. aws_commons
6. bi_staging
7. rds_tools
> show me all the tables with 'sales' in the name
⠸ thinking... Running select query: SELECT table_name FROM information_schema.tables WHERE table_name LIKE '%%sales%%' ORDER BY table_name;
[assistant] --> The tables with 'sales' in the name are as follows:
- salesorderdetail
- salesorderheader
- salesorderheadersalesreason
- salesperson
- salespersonquotahistory
- salesreason
- salestaxrate
- salesterritory
- salesterritoryhistory
- vsalesperson
- vsalespersonsalesbyfiscalyears
- vsalespersonsalesbyfiscalyearsdata
> how many rows are in the salesperson table?
⠏ thinking... Running select query: SELECT COUNT(*) FROM sales.salesperson;
[assistant] --> The `salesperson` table contains 17 rows.
Getting started
You need credentials for your database, and you will need an OpenAI API Key from your OpenAI account.
Installation:
pip install gptsql
or download the source.
Run the CLI with:
gptsql
or use python -m gptsql
to run from source.
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
gptsql-0.1.1.tar.gz
(7.6 kB
view details)
Built Distribution
File details
Details for the file gptsql-0.1.1.tar.gz
.
File metadata
- Download URL: gptsql-0.1.1.tar.gz
- Upload date:
- Size: 7.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.3.1 CPython/3.9.13 Darwin/23.1.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f1459cf990e994cd62ebb3e7cf9782c60e5c9114511d902e0cc5a01c16246918 |
|
MD5 | 3107663afa301470e72e8506722ab610 |
|
BLAKE2b-256 | e45fb39709757d1428d63129e040e5e72ac49e4673df8d6dd026ad2ab7f82eb4 |
File details
Details for the file gptsql-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: gptsql-0.1.1-py3-none-any.whl
- Upload date:
- Size: 8.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.3.1 CPython/3.9.13 Darwin/23.1.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1e5d5d6def076656f880035532f397a900d86388a098b965c5ed56c43c6a87a4 |
|
MD5 | e5cfb07546a65e3c8682bd29cde65aaf |
|
BLAKE2b-256 | 9a2b4672d3e924227f45dd7addfe5a1cda16082f81e9201c25d65b5f05262cf2 |