SchemaCrawler is a relational database exploration tool. It obtains database schema metadata such as tables, stored procedures, foreign keys, triggers and so on, and makes them available for search. The traditional way to use SchemaCrawler has been the command-line or an interactive shell.
SchemaCrawler is now integrated with ChatGPT to provide an interactive way to interrogate your database schema metadata. When you start SchemaCrawler with the “chatgpt” command, you will have an interactive chat shell with ChatGPT, enhanced with information about your database metadata. No database information will be sent to OpenAI servers.
You can try prompts such as the following ones:
- "List all tables"
- "Describe the Track table"
- "What are the indexes on the Track table?"
- "What are the Track columns?"
- "What is the Track primary key?"
- "Show me the triggers on Track"
- "Find the parents of Track"
- "What are the dependents of Album?"
To quit the console, you can type something like:
- "I think I have everything I need" or simply, "done", "exit" or "quit".
To start using this integration, you will need to create your own OpenAI API key. Then download a SQLite database called "chinook-database-2.0.1.sqlite" into your current directory.
Run this command:
docker run \
--mount type=bind,source="${PWD}",target=/home/schcrwlr \
--rm -it \
schemacrawler/schemacrawler \
/opt/schemacrawler/bin/schemacrawler.sh \
--server=sqlite \
--database=chinook-database-2.0.1.sqlite \
--info-level=standard \
--command=chatgpt \
--api-key YOUR_OPENAI_API_KEY
(If you are using PowerShell on Windows, replace the trailing backslash on each line with a back-tick, and map the current directory differently.)
At the prompt, enter some of the commands above.
After you have got this working, use the SchemaCrawler command-line to connect to your own database, and explore it using a natural language interface courtesy of ChatGPT.
Top comments (11)
Looks like we have a rainy week-end here... so asking for my favorit database assistant some help about a little database :
This is pretty exciting... and I have some fdedback/improvements : where would like me to drop them to you ?
Dedciated blog post on its way 🚀
AWESOME @sualeh , I'll give it a try very soon. I have to purchase a key.
BTW : would you share with us :
The default model is gpt-3.5-turbo. I spent $0.07 during development, so you can imagine that it does not use too many tokens.
You probably didn't spend 0.07$. I was wondering why I still didn't get access to gpt4, b/c allegedly they have opened the access to everyone they have billed. It turns out they have never billed me anything. My guess is b/c trx costs would outweigh the value of the trx.
Guess I'll create a dedicated story telling, I already a target database I could inspect this way.
BtW, is the duckdb driver fixed ?
That will be great!
The DuckDB driver is not fixed yet.
ARFF ;-(
Also Read - 10 New AI Tools You Shouldn't Miss.
I am unable to access uploaded .csv file for chatbot process by using openai api key in nextjs project.Kindly suggest me any libraries or logic to moveahead.
Some comments may only be visible to logged-in visitors. Sign in to view all comments. Some comments have been hidden by the post's author - find out more