5 ms·
Show HN: SnapQL – Desktop app to query Postgres with AI
SnapQL is an open-source desktop app (built with Electron) that lets you query your Postgres database using natural language. It’s schema-aware, so you don’t need to copy-paste your schema or write complex SQL by hand.
Everything runs locally — your OpenAI API key, your data, and your queries — so it's secure and private. Just connect your DB, describe what you want, and SnapQL writes and runs the SQL for you.
- pescn 1y agoWow, this looks really cool. What is the current support for OpenAI proxy or non-GPT models? For example, using locally deployed Qwen models or LLaMA models.
- antifarben 1y agoOh, I'm looking forward of this client being available as a Flatpak although especially in this case some folks might prefer it to have it available via Snap :D
- zicon35 1y agocongrats on the launch! This looks very interesting
- jaimin888patel 1y agoawesome work nick, literally been asking for a vibe coding SQL interface for months
- nicktikhonov 1y agothanks Jaimin. happy you finally found what you were looking for :D
- esafak 1y agoIf you can do this, can't you create a read-only user and use it with a database MCP like https://github.com/executeautomation/mcp-database-server https://github.com/executeautomation/mcp-database-server ? Am I missing something?
- boredemployee 1y ago[flagged]
- deleted 1y ago[deleted]
- nicktikhonov 1y agoYou can set up an MCP and use it in your existing AI app, but is afaiu the first open source standalone app that gives you a familiar interface to other SQL workspace tools. I built it to be a familiar but much more powerful experience for both technical and nontechnical people.
- esafak 1y agoThere are competitors with a GUI too, such as https://www.sqlchat.ai/ https://www.sqlchat.ai/ and https://www.jetbrains.com/datagrip/features/ai/ https://www.jetbrains.com/datagrip/features/ai/ I wish you luck in refining your differentiation.
- BenderV 1y agoSelfless plug, our own tool => https://www.myriade.ai https://www.myriade.ai > I wish you luck in refining your differentiation. Can't agree more with you. It's about distribution (which Snowflake/Databricks/... have) or differentiation. Still, chatting with your data is already working and useful for lots.
- nicktikhonov 1y agoThe first doesn't have good UX and the second isn't open source. SnapQL is both :) But I'll find new ways to differentiate for sure, it's part of the fun of building.
- _9y71 1y agoYour project is source-available, not open-source. Consider adding a license.
- GarrickDrgn 1y agoAm I misunderstanding something? How is this "Everything runs locally" if it's talking to OpenAI's APIs?
- whilenot-dev 1y agoThis app is using OpenAI via the ai package[0][1], so "Everything runs locally" is definitely misleading. [0]: https://github.com/NickTikhonov/snap-ql/blob/409e937fa330deb2e45e9120e551acf2b2615f64/src/main/lib/db.ts#L41 https://github.com/NickTikhonov/snap-ql/blob/409e937fa330deb... [1]: https://github.com/vercel/ai https://github.com/vercel/ai
- deleted 1y ago[deleted]
- piskov 1y agoI guess he means there is no proxy between you and openai. API key won’t leak, etc.
- nicktikhonov 1y agoWhat I meant was that it isn't a web app and I don't store your connection strings or query results. I'll make this more clear
- omega3 1y agoYou might not but openai does.
- doctorpangloss 1y agoAPI gateways could accept public keys instead of generating bearer tokens. Then the private key could reside in an HSM, and apps like this could give HSMs requests to sign. IMO even though this could be done in an afternoon, everyone - Apple and Google, the CDN / WAF provider, the service provider - is too addicted to the telemetry.
- nicktikhonov 1y ago
- jasonthorsness 1y agoLooks useful! And the system prompt didn't require too much finessing. I wonder how it would work with some later models than gpt-4o as in my own dabbling around gpt-4o wasn't quite there yet and the latest models are getting really good. For analytical purposes, this text-to-SQL is the future; it's already huge with Snowflake (https://www.snowflake.com/en/engineering-blog/cortex-analyst-text-to-sql-accuracy-bi/ https://www.snowflake.com/en/engineering-blog/cortex-analyst...).
- nicktikhonov 1y agoAppreciate the input! I'd love to be able to support more models. That's one of the issues in the repo right now. And I'd be more than happy to welcome contributions to add this and other features
- kebsup 1y agoI was looking for something like this that supports graphs.
- nicktikhonov 1y agoGraph generation is next on the list.
- JofArnold 1y agoNeo4j?
- s1mplicissimus 1y agoAre there plans to support other LLM sources, in particular ollama?
- nicktikhonov 1y agoYes! https://github.com/NickTikhonov/snap-ql/issues/1 https://github.com/NickTikhonov/snap-ql/issues/1
- s1mplicissimus 1y agoawesome, looking forward to try it with a self hosted model
- revskill 1y agoWhat's the underlying model to enable this ?
- nicktikhonov 1y agoCurrently OpenAI 4o
- revskill 1y agoSo u already train all knowledgebase or fine tune? Would love to know how can u evaluate correctness.
- ramoz 1y agothey don't it's simple a zero-shot text to sql interface. the app development started 2days ago. https://github.com/NickTikhonov/snap-ql/blob/main/src/main/lib/db.ts#L50 https://github.com/NickTikhonov/snap-ql/blob/main/src/main/l...
- sirjaz 1y agoLooks like a good idea. Any reason you didn't use React native?
- nicktikhonov 1y agoNot really - I had some previous experience with electron and wanted to finish the core feature set in a few hours, so just went with what I already know.
- jpb0104 1y agoI like this a lot. I am looking forward to having something similar built into Metabase.
- anshumankmr 1y agoWould love to contribute. I have made a fork, will try and raise a PR if contributions are welcome. Question, how are you testing this? Like doing it on dummy data is a bit too easy. These models, even 4o, falter when it comes to something really specific to a domain (like I work with supply chain data and other column names specific to the work that I do, that only makes sense to me and my team, but wouldn't make any sense to an LLM unless it somehow knows what those columns are)
- nicktikhonov 1y agoI'm using my own production databases at the moment. But it might be quite nice to be able to generate complex databases with dummy data in order to test the prompts at the higher levels of complexity! And thank you for offering to contribute. I'll be very active on GitHub!
- gabrielruttner 1y agoThis is nice -- we're heavy users of postgresql and haven't found the right tool here yet. I could see this being incredible if it had a set of performance related queries or ran explain analyze and offered some interpreted results. Can this be run fully locally with a local llm?
- nicktikhonov 1y agoThank you for the feedback. Please feel free to raise some issues on the repo and we can jam this out there
- stephancill 1y agojust opened a PR for local llm support https://github.com/NickTikhonov/snap-ql/pull/11 https://github.com/NickTikhonov/snap-ql/pull/11
- nicktikhonov 1y agoMerged! Thanks Stephan
- throwmeaway9876 1y agoGreat tool! Pardon my technical ignorance, but what exactly is OpenAI's API being used for in this?
- nicktikhonov 1y agoOpenAI LLM is used to generate SQL based on a combination of a user prompt and the database schema.
- throwmeaway9876 1y ago[dead]
- bobbyraduloff 1y ago[flagged]
- nicktikhonov 1y agoInteresting lead. What else would they be looking for in a tool like this? My bad re the video, I'll make sure not to toggle dark mode in the next one.
- deleted 1y ago[deleted]
- thedudeabides5 1y agodata engineering about to be eaten by llms
- iJohnDoe 1y agoWhich MCP is the recommended or “official” for SQLite and PostgreSQl for use with Cursor?
- sgarland 1y agoGenuinely do not understand the point of these tools. There is already a practically natural language to query RDBMS; it’s called SQL. I guarantee you, anyone who knows any other language could learn enough SQL to do 99% of what they wanted in a couple of hours. Give it a day of intensive study, and you’d know the rest. It’s just not that complicated.
- nicktikhonov 1y agoand yet this was on the front page of hacker news for an entire day :D it's all about friction. why spend minutes writing a query when you can spend 5 seconds speaking the result you want and get 90-100% of the way there.
- sgarland 1y agoMostly because you don’t know if it’s correct unless you know SQL. It’s entirely too easy to get results that look correct but aren’t, especially when using windowing functions and the like. But honestly, most queries I’ve ever seen are just simple joins, which shouldn’t take you 5 minutes to write.
- AdieuToLogic 1y ago> Mostly because you don’t know if it’s correct unless you know SQL. It’s entirely too easy to get results that look correct but aren’t ... This is the fundamental problem when attempting to use "GenAI" to make program code, SQL or otherwise. All one would have to do is substitute SQL with language/library of choice above and it would be just as applicable.
- sgarland 1y agoFully agree, I just harp on SQL because a. It’s my niche b. It always seems to be a “you can know this, but it doesn’t really matter” thing even for people who regularly interact with RDBMS, and it drives me bonkers.
- 1y ago
- fkirtrdwnkr 1y ago[dead]
- joshstrange 1y agoI might test this out, but I worry that it suffers from the same problems that I ran into the last time I played with LLMs writing queries. Specifically not understanding your schema. It might understand relations but most production tables have oddly named columns, potentially columns that changed function overtime, potentially deprecated columns, internal-lingo columns, and the list goes on. Granted, I was using 3.5 at the time, but even with heavy prompting and trying to explain what certain tables/columns are used for, feeding it the schema, and feeding it sample rows, more often than not it produced garbage. Maybe 4o/o3/Claude4/etc can do better now, but I’m still skeptical.
- brulard 1y agoI got better results with Claude Code + PostgreSQL MCP. I let claude understand my drizzle schema first, and i can instruct it to also look at the usage of some entities in the code. Then it is smarter in understanding what the data represents.
- nicktikhonov 1y agomight be possible to solve this with prompt configuration. e.g. you'd be able to explain to the llm all the weird naming conventions and unintuitive mappings
- joshstrange 1y agoI did that the last time (again, only with 3.5, things have hopefully improved in this area). And I could potentially see LLMs being useful to generate the “bones” of a query for me but I’d never expose it to end-users (which was what I was playing with). So instead of letting my users do something like “What were my sales for last month?” I could use LLMs to help build queries that were hardcoded for various reports. The problem is that I know SQL, I’m pretty good at, and I have a perfect understanding of my company’s schema. I might ask an LLM a generic SQL question but trying to feed it my schema just leads to (or rather “led to” in my trials before) prompt hell. I spent hours tweaking the prompts, feeding it more context, begging with it to ignore the “cash” column that has been depreciated for 4+ years, etc. After all of that it still would make simple mistakes that I hard specially warned against.
- pu_pu 1y agoCan you please add support to add descriptions of each column and enumerated types? For example, if a column contains 0 or 1 encoding the absence of presence of something, LLMs need to know what 0 and 1 stand for. Same goes of column names because they can be cryptic in production databases.