TalkToSQL
TalkToSQL is an CLI tool that lets you query your DB with natural language instead of SQL queries.
Usage
$ talktosql learn
Successfully saved the DB Schema Info to /Users/woniesong92/.talktosql_schema_info
$ talktosql ask --q "Who owns a dog?"
SELECT o.first_name, o.last_name FROM Owners o JOIN Pets p ON o.owner_id = p.owner_id WHERE p.species = 'dog';
+------------+-----------+
| first_name | last_name |
+------------+-----------+
| John | Doe |
| Jane | Doe |
| Bob | Smith |
+------------+-----------+
$ talktosql ask --q "Is there anyone who owns a cat named Mittens?"
SELECT o.first_name, o.last_name FROM Owners o JOIN Pets p ON o.owner_id = p.owner_id WHERE p.species = 'cat' AND p.pet_name = 'Mittens';
+------------+-----------+
| first_name | last_name |
+------------+-----------+
| Alice | Johnson |
+------------+-----------+
Quickstart
-
Install the package
pip install talktosql -U -
Set the environment variables
You can create a
.envfile in your local directory to get kickstarted.OPENAI_API_KEY="SOME_API_KEY" OPENAI_ORG_ID="SOME_ORG_ID" OPENAI_MODEL_NAME="gpt-4" TALKTOSQL_DATABASE_URL="mysql://myuser:mypassword@localhost/mydb" TALKTOSQL_DATABASE_NAME="mydb"
Alternatively, you can run these in your terminal or set these in your terminal config (~/.zshrc)
export OPENAI_API_KEY="SOME_API_KEY" export OPENAI_ORG_ID="SOME_ORG_ID" export OPENAI_MODEL_NAME="gpt-4" export TALKTOSQL_DATABASE_URL="mysql://myuser:mypassword@localhost/mydb" # export TALKTOSQL_DATABASE_URL="postgresql://myuser:mypassword@localhost/mydb" export TALKTOSQL_DATABASE_NAME="mydb"
- Get the value for
OPENAI_API_KEYfrom OpenAI API Keys - Get the value for
OPENAI_ORG_IDfrom OpenAI Org Settings
- Get the value for
-
Help TalktoSQL learn your DB Schema. This will save your DB schema info to a file in your home directory (
~/.talktosql_schema_info)talktosql learn -
Query your DB in English intead of an SQL query
talktosql ask --q "how many dogs are there?"
Metadata
Release files for talktosql 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| talktosql-0.0.1.tar.gz | 5.8 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| talktosql-0.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 12.2 kB
Release files / talktosql-0.0.1.tar.gz
| Download URL | talktosql-0.0.1.tar.gz |
|---|---|
| Size | 5.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
93b1504e10c7b457d33f0868bd5c4a552b510b2d6d8c8cb692db2d71d5b0608a
|
|
BLAKE2b-256 checksum How to use checksums |
6c8f402bb21eaf47bcefcaa68ae1c563f4684873c7a130a74eee5045aa56b6d5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.6
|
Release files / talktosql-0.0.1-py3-none-any.whl
| Download URL | talktosql-0.0.1-py3-none-any.whl |
|---|---|
| Size | 6.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1427d11399281d21c8246606a5746ded9bad2f233e5453bd038783ce89ecfd80
|
|
BLAKE2b-256 checksum How to use checksums |
d4c2946a9ff9e85180152dac50b71152078fa8ace2836e0792c4a860f4c48803
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.6
|
Security for talktosql 0.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.