-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3612e07
commit 67960a1
Showing
1 changed file
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
Convert text prompts to sql for your postgres db. | ||
|
||
Grabs database DDL to use in the GPT prompts, creating working queries. | ||
|
||
To run: | ||
` | ||
go run aisql.go -K [openai auth key] -C '[postgres connection string]' | ||
` | ||
|
||
Example: | ||
``` | ||
-> Give me all animals who's name starts with D | ||
Response start======= | ||
SELECT * | ||
FROM animals | ||
WHERE name LIKE 'D%' -- This query will return all animals whose name starts with the letter D. The LIKE operator is used to search for a pattern in a column. The '%' wildcard character is used to match any number of characters after the letter D. | ||
Response finish====== | ||
Execute query? [y/N] | ||
y | ||
id | name | type | age | registered_at | image | owner_id | ||
-----+-----------+----------+-----+--------------------------+----------------------------------+---------- | ||
54 | Devon Rex | insect | 14 | 2021-06-18T20:40:34.991Z | http://placeimg.com/640/480/cats | 17 | ||
104 | Devon Rex | cetacean | 4 | 2021-11-02T06:34:56.853Z | http://placeimg.com/640/480/cats | 37 | ||
(2 rows) | ||
-> | ||
``` |