Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

A raycast extension to query a Postgre SQL database using GPT generated SQL queries and visualize results using Chart.js

License

Notifications You must be signed in to change notification settings

mdolr/raycast-queryGPT

Repository files navigation


Raycast QueryGPT

A raycast extension to query a Postgre SQL database using GPT generated SQL queries and visualize results using Chart.js

Inspired by censusgpt.com and Metabase questions

A little demo with data form ProductHunt's API

demo

Like this project ?

  • 🐥 Follow me on Twitter: @m_dolr
  • ⭐️ Star this repository on GitHub

⚠️ Disclaimer

The code contains direct evaluation from GPT responses. This project is provided without any warranty. It is not intended to be used in production. Run at your own risks.

Requirements

  • An OpenAI GPT API Key
  • A Postgres SQL Database
  • Raycast v1.48.8+

Development

  1. git clone raycast-queryGPT
  2. cd raycast-queryGPT
  3. yarn
  4. yarn dev

Approach

The question is passed to GPT along with a description of the database schema, GPT is asked to return a SQL Query.

The SQL Query is then executed against the database

The query and a sample table of the results are passed to GPT in order to ask for what would be the most appropriate visualization for the results between "sentence", "chart" and "table"

Depending on the chosen type the results are then displayed in the appropriate format either using a sentence generated by GPT or by using a JS Object dynamically generated and passed to Chart.js

Use with your DB

Update the initial prompt in api.ts:101 to match your DB schema

Improvements

  • Have some kind of setup where there is an initialization phase synchronizing the schema and asking the user to describe the schema dynamically during the setup phase and on migrations

License

This project is licensed under the MIT license. See the LICENSE file for more info.

About

A raycast extension to query a Postgre SQL database using GPT generated SQL queries and visualize results using Chart.js

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published