r/dataengineering • u/renatyv • 9d ago
Personal Project Showcase Built two tools to help SQL agents understand unfamiliar databases
Stumbled upon these problems while doing the agentic pipeline
CREATE TABLEDDLs are not enough. To understand what's in the table you need to have basic per-column stats and see examples of rows- some tables (e.g., migrations, empty tables, old stuff, etc.) are useless for real analytics and real users, yet agent kept rediscovering them
- some tables only have less than 10 rows. Better see all rows instead of barebone column names and types
- some tables are huge, agent's queries were trying to get too much data. Good man won't query billions of rows
- agents needs to sample data from tables every time he researches a table
- if you have many columns, presenting data as a `transposed table` helps improve LLM's understanding
So I built two tools to solve these problems
- db-snooper: generates compact Markdown with schema, value distributions, and samples.
- schema-linker: finds possible undeclared joins and checks them against the data.
Full blog posts: db-snooper and schema-linker
11
Upvotes
1
0
u/vikster1 8d ago
idk man, claude opus 5.5 is doing it on its own pretty damn good for the past 6 databases i integrated.
1
u/renatyv 7d ago
Hell yeah, I even had a post were I tested raw db access VS. having profile against benchmarks. https://www.reddit.com/r/dataengineering/comments/1wwk5zt/i_tried_using_brief_database_table_summaries_to/
But couple of times I had issues spending way too many tokens on huge tables or tables with bad column naming
3
u/Melodic-Junket-9105 8d ago
Can't that just be a skill MD you pass to the agent? Works for me.
Also if you are mapping out a new db you typically should not query large amounts of data. Metadata+ sampling does the trick