Live data from Hacker News

Vanna.ai: Chat with your SQL database

github.com

151–160 of 243 posts

Re: Vanna.ai: Chat with your SQL database

#151
post #112

Earlier quoted context omitted.

What technical benefits?

A translation engine between natural language and SQL means that everyone can communicate with a SQL database now. That's huge. Soon also DB people will use it to get the response for complex questions and queries. It's just more natural and way faster. With technology like this, there is little reason to even know SQL anymore as the average developer. Just like today, the average developer doesn't know how databases…

This somewhat already exists in the form of semantic layers, which if done well can handle many of the queries necessary in the course of business without business users needing to know any SQL. There will still be cases where you need direct SQL, and AI tools can help the development process there at a minimum.

Re: Vanna.ai: Chat with your SQL database

#152

Earlier quoted context omitted.

> In the age of ORMs and so on, many people have probably forgotten how to write raw SQL queries. I’ve heard this general sentiment repeated quite a lot - mostly by people that don’t use ORMs. In my experience pretty quickly you reach the limits of even the best ORMs and need to write some queries by hand. And these tend to be the relatively complicated queries. You need to know about all of the different join types,…

ORM abuse are absolutely rife in small-scale/volume build industries i.e. web agencies, outsourced crews 8/10 projects I look into don't have any indexes set up. Use of ORMs with little thought into lazily loaded relations lead to 100s of queries being done per request. It's pretty mad. Do not underestimate the propensity of a developer to stick to the only tool they know how to use. Unfortunately ORMs like Eloquent…

> small-scale/volume build industries i.e. web agencies, outsourced crews

Well that could explain it. I’ve only worked in companies where everyone working on the app codes with the expectation that they could be dealing with their mistakes for years.

Re: Vanna.ai: Chat with your SQL database

#153
post #83

Earlier quoted context omitted.

It would be for people who are not that fluent in SQL. Even as a dev, I find ChatGPT to be easier for writing queries than hand coding them as I do it so infrequently.

Yeah, same here. Seems like that approach is much simpler than this. I guess the real benefit here is that you don’t need to understand the schemas so the knowledge is not lost when someone leaves a company. Sort of an abstraction layer for the schemas

Sounds like you are describing a semantic layer. You don't need AI to achieve that, though it is fun when it works. Example of a semantic layer I made below, but there are others out there with more support behind them.

https://github.com/totalhack/zillion

Re: Vanna.ai: Chat with your SQL database

#154
post #71

Earlier quoted context omitted.

All the podcasts I've been listening to recommend RAG over fine-tuning. My intuition is that having the relevant knowledge in the context rather than the weights brings it closer to the outputs, thereby making it much more likely to provide accurate information and avoid hallucinations/confabulations.

> All the podcasts I've been listening to recommend RAG over fine-tuning I'm always suspicious that is just because RAG is so much more accessible (both compute wise and in terms of expertise required). There's far more profit in selling something accessible to the masses to a lot of people than something only a niche group of users can do. I think most people who do actual fine tuning would still probably then use R…

One added benefit of RAG is that it's more "pluggable." It's a lot easier to plug into newer LLMs that come out. If and when GPT-5 comes out, it'll be a one character change in your code to start using it and still maintain the same reference corpus.

Re: Vanna.ai: Chat with your SQL database

#155
post #138

Earlier quoted context omitted.

Curious, as we're looking to build / use a similar setup. > Debugging LLM prompts is just tricky... Customers can confuse the model pretty easily. Would a RAG like how Vanna.ai uses, help? > For example, sometimes it forgets to check one or another field Do prompting techniques like CoT improve the outcome? > So we need to teach customers to nudge the report generator a bit towards generic terms. Did you folks experi…

Our primary issue is that our DB is a dynamic Entity-Attribute-Value schema, even quite a bit denormalized at that. The model has to remember to do subqueries to retrieve "attributes" based on what's needed for the query and then combine them correctly. NLQ is a somewhat new feature for us, so we don't have a great library to pull from for RAG. Experimenting, I found that having a few-shot examples with some CoT (sho…

Maybe you could utilize views to make your EAV schema more friendly for the LLM? Whether that's realistic depends on the specifics of your situation of course.

Re: Vanna.ai: Chat with your SQL database

#156

I'm curious to see if people have tried this out with their datasets and seen success? I've been using similar techniques at work to build a bot that allows employees internally to talk to our structured datasets (a couple MySQL tables). It works kind of ok in practice, but there are a few challenges: 1. We have many enums and data types specific to our business that will never be in these foundation models. Those ha…

Have you considered a semantic layer instead, or does it have to be a natural language interface?

Re: Vanna.ai: Chat with your SQL database

#157

How about instead of making AI wrappers to over 50 years old SQL, we’d make a database query language that’s easier to read an write?

In general, if something has been around for a very long time and nobody apparently seems to have thought to improve it, then odds are the reason is it's pretty good and genuinely hard to improve on.

Because SQL is a good query language, if you bother to really learn it.

Re: Vanna.ai: Chat with your SQL database

#158

Earlier quoted context omitted.

It doesn't matter, RAG is very temporary and will not be around long imho.

RAG, at its core, is a very human way of doing research, because RAG is essentially just building a search mechanism for a reasoning engine. Much like human research. Your boss asks you to look into something, and you do it through a combination of structured and semantic research. Perhaps you get some books that look relevant, you use search tools to find information, you use structured databases to find data. Then…

Yes, 100%! Can you turn this comment into a blog post so that I can send it to people who make this claim?

Re: Vanna.ai: Chat with your SQL database

#159
post #130

Thanks so much for making this and making it under MIT to boot. I’ve been thinking about how to do this for about 6 months now and just started working on a demo for querying just one table // JSON column today. I would feel a lot more comfortable with putting this (and/or my demo) into production if the database had been set up with a schema+db user per account rather than every tenant sharing just the one set of ta…

Author of the package here. Apologies if this wasn't clear in the documentation, but what you're talking about is absolutely possible. Feel free to join our Discord -- we have other users who have this multi-tenant setup.

Re: Vanna.ai: Chat with your SQL database

#160
post #131

im curious to know how you get around the hallucinations? for example, for the query: "give me that were created yesterday" the llm hallucinates as to what "yesterday" means, there are other instances as well where the generated SQL is valid syntax-wise but not in intent. This is especially dangerous for aggregation queries such as MAX, COUNT, etc because it will spit out a number but is it the right number? and the…

That's a fair concern. In actual usage, however, the vast majority of hallucination (>90%) tends to be:

- phantom tables and columns, in which case the query will fail

- incorrect syntax for date functions (i.e. the wrong flavor of SQL)

And we tend to see less of this type of hallucination when there are lots of example SQL queries that have been "trained" into the RAG system.

Post reply on HN