Mini Text-to-SQL Demo
Offline, LLM-free demo of the schema-linking + validate + execute loop described in the article Text-to-SQL 与 Agentic Query.
Dependencies
- Python 3.9+
sqlglot==25.6.1
pip install sqlglot==25.6.1Run
python mini_text2sql.pyWhat it shows
The script builds an in-memory SQLite database with
customers and orders tables, then
runs four natural-language questions through the
pipeline:
how many orders?— counts rows.what is the average amount?— aggregatesAVG.top orders by amount— ORDER BY … DESC LIMIT.please hallucinate a column— deliberately generates invalid SQL so you can observe the validator rejectingghost_coland the join with noONclause.
The Mock LLM is deterministic; replace it with any real
LLM (OpenAI, Ollama, llama-cpp-python …) by providing the
same
generate(prompt, question, schema) -> str
interface.
Offline
No network access is required. sqlglot is a
pure-Python SQL parser.
同主题继续阅读
把当前热点继续串成多页阅读,而不是停在单篇消费。
【数据库研究前沿】Text-to-SQL 与 Agentic Query:DIN-SQL、C3、DAIL-SQL 工程复盘
Spider / BIRD 评测、DIN-SQL / C3 / DAIL-SQL 的核心机制、schema linking 与 self-consistency,以及一个离线可跑的最小 Text-to-SQL 闭环 demo
【数据库前沿】【数据库研究前沿】流批一体与增量视图:Materialize、RisingWave、Feldera 的 DBSP 理论
以 IVM 历史、Differential Dataflow、DBSP(Z-set 与线性化)为主线,对比 Materialize、RisingWave、Feldera 的架构取舍,划清与 Flink/Kafka Streams 的能力边界,并附 Python Z-set 最小增量 join demo
【数据库前沿】【数据库研究前沿】HTAP 新范式:从 TiDB、SingleStore 到 Lakehouse 一体化
从工作负载隔离到行列双维护,系统梳理 TiDB + TiFlash、SingleStore Universal Storage、F1 Lightning 与 Lakehouse 的设计取舍、新鲜度边界与 HTAP 基准测试方法
【数据库前沿】【数据库研究前沿】Serverless 数据库弹性理论:Neon 与 Aurora Serverless v2
从 Aurora 的日志即数据库到 Neon 的 pageserver/safekeeper/compute 三层分离,拆解 Serverless 数据库的冷启动、细粒度伸缩与 copy-on-write 分支,并给出本地可跑的 Neon demo 指引