Use ChatGPT to Discover Your Database Schema

SchemaCrawler is a relational database exploration instrument. It obtains database schema metadata comparable to tables, saved procedures, international keys, triggers and so forth, and makes them accessible for search. The normal manner to make use of SchemaCrawler has been the command-line or an interactive shell.

SchemaCrawler is now built-in with ChatGPT to offer an interactive strategy to interrogate your database schema metadata. While you begin SchemaCrawler with the “chatgpt” command, you’ll have an interactive chat shell with ChatGPT, enhanced with details about your database metadata. You possibly can strive prompts comparable to the next ones:

  • “Record all schemas”
  • “Record all tables”
  • “Describe the Observe desk”
  • “Present me all the main points of a desk whose title is one thing like ‘tra'”
  • “What are the indexes on the Observe desk?”
  • “What are the Observe columns?”
  • “What’s the Observe major key?”
  • “Present me the triggers on Observe”
  • “Discover the dad and mom of Observe”
  • “What are the dependents of Album?”

To give up the console, you may kind one thing like:

  • “I believe I’ve all the things I would like”
    or just, “executed”, “exit” or “give up”.

To begin utilizing this integration, you’ll need to create your individual OpenAI API key. Then obtain a SQLite database known as “chinook-database-2.0.1.sqlite” into your present listing.

Run this command:

docker run 
--mount kind=bind,supply="${PWD}",goal=/house/schcrwlr 
--rm -it 
Enter fullscreen mode

Exit fullscreen mode

(If you’re utilizing PowerShell on Home windows, exchange the trailing backslash on every line with a back-tick, and map the present listing in a different way.)

On the immediate, enter a few of the instructions above.

After you’ve got this working, use the SchemaCrawler command-line to hook up with your individual database, and discover it utilizing a pure language interface courtesy of ChatGPT.

Leave a Reply

Your email address will not be published. Required fields are marked *