Highlights
- Knowledge graphs map database schemas as connected structures, enabling LLMs to traverse multi-hop relationships that vector similarity search cannot discover through semantic matching alone.
- QueryWeaver uses FalkorDB to store schema metadata as nodes and relationships, allowing the system to find intermediate tables like vendor_agreement that lack semantic similarity to queries.
- Graph traversal solves the 5-hop query problem by walking structural paths between tables, while vector databases only retrieve semantically similar endpoints and miss the connective tissue.
For over 60 years, developers have chased Text-to-SQL conversion. Even with today’s LLMs, most solutions fail when they encounter complex enterprise schemas.
For months, I obsessed over a frustrating loop, involving late nights staring at failed SQL queries. My screen became a graveyard of syntax errors and hallucinated joins that no amount of prompt engineering could fix. I realized that even with perfect prompts, I was giving the LLM a jigsaw puzzle with no picture on the box.
Most vector-based implementations treat databases like flat shopping lists. But a database schema isn’t a list: it’s a web of connections. That was my breakthrough. What if we mapped the entire schema as a Knowledge Graph? What if we enriched the nodes with primary keys and null-handling rules and connected that to the LLM?
This became the core of QueryWeaver. Using FalkorDB, we built a system where the model doesn’t just read a dictionary: it follows a map.
-- Missing vendor_agreement bridge
-- No actual FK relationship exists
-- Actual storage format is '0040'
-- Should be publisher.legal_name not publisher.name
Building an Architecture of Trust
Building QueryWeaver required more than just a graph. We created an Architecture of Trust. Over the past month, we developed a 10-point blueprint to move from guessing queries to calculating them:
The Stress Test: Breaking the "Superhero" Schema
To prove this architecture worked, I built a stress test that mirrored the messy reality of enterprise data.
I took the Superhero database from the BIRD Benchmark (the industry gold standard). In its original form, it was too clean. I expanded it into a 60-table case, adding the boring connective tissue found in real organizations: vendor agreements, stakeholder registries, and resource logs.
The difference between vector-based retrieval and our graph-powered retrieval was stark.
“The real breakthrough in Text-to-SQL comes when you stop treating the schema as a document to embed and start treating it as a graph to traverse.”
— Roi Lipman, CTO of FalkorDB
The Missing Link (The "Generic" Table)
publisher and royalty_ledger tables through semantic similarity.
vendor_agreement bridge table because "vendor agreement" has zero semantic connection to "royalty payments."
publisher and royalty_ledger except through vendor_agreement.
superpower and budget_allocation.
stakeholder_registry because "stakeholder" has no semantic link to "superpowers."
superpower → capability_matrix → stakeholder_registry → resource_requisition → budget_allocation
stakeholder_registry simply because it was the only road connecting the entities.
The Verdict: Stop Guessing, Start Weaving
This journey taught me a lesson: Vectors find the “What” (the nouns), but Graphs find the “How” (the logic).
QueryWeaver isn’t just a Text-to-SQL converter: it’s a Reasoning Engine for Data. Every answer it gives is:
- Mapped by a Knowledge Graph
- Governed by a strict Constitution of logical rules
- Verified and healed by an autonomous Healer agent
- Interpreted by an intelligent Analyst layer
The needle in the wood is no longer hidden: it’s illuminated.
Explore the project and join the build: https://www.queryweaver.ai/
Learn more about the benchmark used in this experiment: BIRD Benchmark (https://bird-bench.github.io/)
FAQ
Why do vector databases fail at multi-hop Text-to-SQL queries?
Vector databases use semantic similarity to retrieve tables. They miss intermediate tables with generic names that have no semantic relationship to the query but are structurally required.
How does graph traversal improve Text-to-SQL accuracy?
Graph traversal walks the actual foreign key relationships between tables, discovering all intermediate nodes on the path between query entities regardless of semantic similarity.
What makes QueryWeaver different from standard Text-to-SQL solutions?
QueryWeaver stores the entire schema as a knowledge graph in FalkorDB, enriches nodes with metadata, and uses graph algorithms to find structurally mandatory tables for complex joins.
References and citations
BIRD Benchmark: Cross-Domain Text-to-SQL Evaluation – https://bird-bench.github.io/
FalkorDB Documentation: Graph Database for LLM Applications – https://docs.falkordb.com/
QueryWeaver Project – https://www.queryweaver.ai/