DEV Community

Sualeh Fatehi
Sualeh Fatehi

Posted on

Use ChatGPT to Explore Your Database Schema - Part 2

As a follow on to Use ChatGPT to Explore Your Database Schema, SchemaCrawler's integration with ChatGPT in SchemaCrawler v16.20.4 allows you to share database metadata with OpenAI (ChatGPT), allowing for richer questions. SchemaCrawler needs your permission to share this metadata by means of an additional command-line argument, --use-metadata.

You can ask ChatGPT very specific questions on your schema, for example to summarize the purpose of the database or to help you write SQL queries.

You can try prompts such as the following ones:

  • Summarize my database schema in one paragraph
  • Based on my schema, write a SQL query for book names and author names
  • Based on my schema, write a SQL query to find all books that have previous editions

Please note that if you have a large schema, you may run out of the maximum possible tokens. You can adjust this by using SchemaCrawler command-line arguments to limit the number of tables with regular expressions. Or you can use SchemaCrawler's integration with ChatGPT as described in Part 1, without --use-metadata.

Top comments (4)

Collapse
 
sualeh profile image
Sualeh Fatehi

@adriens - here you go with your feature request.

Collapse
 
adriens profile image
adriens

Wouldn't you like to create a dedicated Schemacrawler on ChatGPT series ?

Collapse
 
sualeh profile image
Sualeh Fatehi

I think I am done for the time being. This was a fun ride. Thanks for all your suggestions.

Collapse
 
adriens profile image
adriens

Awesome... just have to play with it now !