Skip to content

Commit

Permalink
Update notes on ChatGPT integration
Browse files Browse the repository at this point in the history
  • Loading branch information
sualeh committed Feb 17, 2024
1 parent 12c9933 commit c54fb68
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions schemacrawler-website/src/site/markdown/schemacrawler-chatgpt.md
@@ -1,6 +1,6 @@
# Interactive Shell with ChatGPT

SchemaCrawler is integrated with ChatGPT to provide an interactive way to interrogate your database schema metadata. No information about your database schema is shared with OpenAI. To start using this integration, you will need to create your own [OpenAI API key](https://www.howtogeek.com/885918/how-to-get-an-openai-api-key/). Once you have that, use SchemaCrawler from the command-line as you normally would, and connect to your database. Provide `chatgpt` as the SchemaCrawler command, and use an additional command-line argument, `--api-key` to provide your API key. If you do not want to provide this API key in the clear, you can use `--api-key:env` instead, and give the name of an environmental variable that contains the key.
SchemaCrawler is integrated with ChatGPT to provide an interactive way to interrogate your database schema metadata. No information about your database schema is shared with OpenAI. To start using this integration, you will need to create your own [OpenAI API key](https://www.howtogeek.com/885918/how-to-get-an-openai-api-key/). Once you have that, use SchemaCrawler from the command-line as you normally would, and connect to your database. Provide `chatgpt` as the SchemaCrawler command, and provide your OpenAI API key in an environmetal variable called `OPENAI_API_KEY`. Otherwise, you can use an additional command-line argument, `--api-key` to provide your API key. If you do not want to provide this API key in the clear, you can use `--api-key:env` instead, and give the name of an environmental variable that contains the key, if it is different than `OPENAI_API_KEY`.

Once you have this running, you will have an interactive chat shell with ChatGPT, enhanced with information about your database metadata. You can try prompts such as the following ones:

Expand All @@ -18,7 +18,7 @@ To quit the console, you can type something like:

- I think I have everything I need
- or simply, "done", "exit" or "quit"

You can use any language that ChatGPT supports, for example, try something like:

- Combien de tables y a-til dans cette base de données?
Expand All @@ -27,16 +27,16 @@ You can use any language that ChatGPT supports, for example, try something like:
- Décris-moi la table NoName


## Get Summary and Help on the Schema
## Get SQL and Other Help on Your Schema

If you are willing to share your database metadata with OpenAI, you can get additional help from ChatGPT. For example, you can summarize what the database does, get help with writing SQL queries, or with writing good comments on your database schema. To share data, pass an additional command-line argument to SchemaCrawler, `--use-metadata`. Please note that depending on your database schema, this can exceed the maximum tokens allowed by ChatGPT. If you end up exceeding the tokens, either do not use this flag, or use the SchemaCrawler command-line to limit the tables in scope using regular expressions.
If you are willing to share your database metadata with OpenAI, you can get additional help from ChatGPT. For example, you can get help with writing SQL queries, or with writing good comments on your database schema. To share data, pass an additional command-line argument to SchemaCrawler, `--use-metadata`. SchemaCrawler uses Retrieval Augmented Generation (RAG) techniques to select the tables in your schema that will be used to assist with your ChatGPT prompt.

Try out prompts like (even though they may not return completely accurate information):

- Summarize the database 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
- Suggest remarks for columns that do not have them
- Suggest remarks for columns in the Books table
- Summarize the database in one paragraph


## Extensions
Expand Down

0 comments on commit c54fb68

Please sign in to comment.