Show HN: Natural language query interface for Postgres
github.com·5d·
Discuss: Hacker News
Flag this post

pg_gen_query

This extension provides a natural language query interface to Postgres, allowing you do to something like SELECT * FROM pg_gen_query('number of events from Texas').

Usage

Build the extension:

git clone git@github.com:kriti-sc/pg_gen_query.git

in `api_key.hpp`, add OpenAI api key:
const std::string open_api_key = "sk-verylongopenaikey";

make clean && make && make install

Install and use:

CREATE EXTENSION pg_gen_query;

SELECT * FROM pg_qen_query('get all nation names');

Note: first time execution will be slow as the extension develops an understanding of the schema on initialization. This understanding is stored therefore, subsequent executions will be faster.

Example

Below is sample usage against the TPCH schema.

tp...

Similar Posts

Loading similar posts...