Он переводит естественный язык в SQL запросы и выполняет их в базе данных.
На данный момент поддерживаются
MySQL, PostgreSQL и SQLite. Пример:
ormgpt.query("give me post with id 1, all comments for this post and user information about author");Сгенерированный запрос:
SELECT
p.id AS post_id,
p.title,
p.body,
c.id AS comment_id,
c.body AS comment_body,
u.username AS author_username,
u.email AS author_email
FROM
posts p
JOIN comments c ON p.id = c.post_id
JOIN users u ON u.id = p.user_id
WHERE
p.id = 1;
Вывод:
[
{
post_id: 1,
title: 'Hello world!',
body: 'This is my first post!',
comment_id: 1,
comment_body: 'Hello world!',
author_username: 'test',
author_email: 'test@example.com'
}
]• Github
@sqlhub