6
cloudquery/pg_gpt: 用人类语言运行SQL查询
source link: https://www.jdon.com/65746.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
cloudquery/pg_gpt: 用人类语言运行SQL查询
将 OpenAI API 引入 PostgreSQL 以使用人类语言运行查询的实验性扩展。
该扩展将数据库模式的一个子集发送到 ChatGPT,并要求它根据此和用户输入生成一个查询。
安装
需要pgx。首先安装这个:
cargo install --locked cargo-pgx cargo pgx init |
现在您可以安装扩展:
git clone https://github.com/cloudquery/pg_gpt cd pg_gpt export OPENAI_KEY=<YOUR_KEY> cargo pgx run # will drop into psql shell create extension pg_gpt; set openai.key = '<YOUR OPENAPI API KEY HERE>'; -- set your key select gpt('show me all open aws s3 buckets'); -- will output the following query, so you can execute it -- select * from aws_s3_bucket; 在现有 Postgres 实例上安装扩展 第一次运行: cargo pgx install 这会将扩展放在 postgres 扩展目录中。然后,在您的 postgres 实例中,运行: create extension pg_gpt; set openai.key = '<YOUR OPENAPI API KEY HERE>'; -- proceed to use the extension |
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK