-
Notifications
You must be signed in to change notification settings - Fork 179
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Text-to-SQL #24
Comments
Hope Embedding pg_catalo can improve text to sql be more nice that traditional zeroshot or one-shot mod. I based on zero shot idea develop a shiny llm app. It has 5 steps from convert catalog to final get data.
For example, I want to know "find the top 5 sold music name and total revenue and quantity as well as average unit price", the ai will generate sql for me basedon schema and question, I extract data using the ai sql. Below is the detail steps.
"select
'CREATE TABLE ' || nspname || '.' || relname || ' (' || chr(10)||
array_to_string(
array_agg(attname ||
' ' ||
atttypid::regtype::text||
CASE attnotnull WHEN true THEN ' NOT NULL' ELSE ' NULL' end ||
coalesce(' -- COMMENT ' || quote_literal(description), '')||
',' || chr(10)
), ' '
) || chr(10)|| ');' as definition
from
pg_attribute
join
pg_class on
pg_class.oid = pg_attribute.attrelid
join
pg_namespace on
pg_namespace.oid = pg_class.relnamespace
left join
pg_description on
pg_description.objoid = pg_class.oid
and pg_description.objsubid = pg_attribute.attnum
where
nspname not in ('pg_catalog', 'information_schema')
and relkind in ('r', 'v')
group by
nspname, relname;"
=======================================================
Attache my shiny_llm_map git link and demo line for your reference
|
Experiment with text-to-sql from within the database. Can we embed the pg_catalog and use it to power text-to-sql?
The text was updated successfully, but these errors were encountered: