SQL-tString

Data

sql query builder

SHOW HN2025

85points
35comments
#844of 3,837 in 2025
Top 22%of 2025 by points

How HN took it

CuriousMostly questions and neutral comments

2 positive, 6 neutral or asking, 0 mixed, 4 critical, out of 12 comments about the project. Thread score -0.06.

Design: 1 for, 2 againstIdea: 1 for, 0 againstExecution: 0 for, 1 againstPrivacy: 0 for, 1 against

The thread, comment by comment

Each row is a top-level comment and its replies, in HN's order. Select a cell to open that comment on HN.

positive neutral or mixed critical about another commenter or something else the maker

What HN said

What people liked

  • Dynamic query building with Absent is a better approach than if-statement WHERE clauses

    From 1 comment
    • I thought this was just going to be the same ol "where id = {id}" interpolation but dang, those are some crazy examples. I can imagine the behavior takes some trial and error to…
      hombre_fatal on HN

Objections

  • Absent removing clauses could silently drop filters and expose whole tables

    From 1 comment
    • Looks very nice but the Absent functionality seems like a potential foot gun to me, easy to remove an entire WHERE clause and blow up a whole table! If I have a filter in sql…
      bencyoung on HN
  • Parsing non-standard SQL and expression removal is risky for complex queries

    From 2 comments
    • How does the SQL parsing work for the rewrites like removing expressions? I have a project using some non-standard SQL features and we have quite complex queries going on, so the…
      jitl on HN
    • How do you know what the expression is though? Don’t you need to be parsing the SQL? If I have non standard SQL somewhere upstream in the text how does the parser cope?
      jitl on HN
  • Template-based SQL looks like string concatenation and may mislead developers

    From 2 comments
    • No I think your point is valid, and is valid in JavaScript too. Designing the “right” approach to look like the “wrong” approach (string concatenation) is a bad idea, however…
      williamdclt on HN
    • I might have misunderstood your point, but scoping isn’t related to what I’m trying to say. What I’m saying is that, regardless of how it works, I don’t think string templating…
      williamdclt on HN

Requests

  • Support composing queries from fragments while keeping placeholder safety

    From 1 comment
    • I had a question about dynamic query fragments: is there a recommended way to compose larger queries from smaller pieces while preserving placeholder safety and avoiding manual…
      badmonster on HN
  • Use a formal lexer and parser based on the SQL grammar with conformance testing

    From 1 comment
    • Just took a quick look, and it seams like the parser is hand written which is great, but you probably want to build a lexer and parser based on the BNF grammar take a look at how…
      schultzer on HN

Questions

  • How does the parser determine expression boundaries for removal

    From 2 comments
    • How does the SQL parsing work for the rewrites like removing expressions? I have a project using some non-standard SQL features and we have quite complex queries going on, so the…
      jitl on HN
    • How do you know what the expression is though? Don’t you need to be parsing the SQL? If I have non standard SQL somewhere upstream in the text how does the parser cope?
      jitl on HN
  • Can different column allowlists be used for different parts of a query

    From 1 comment
    • The columns feature seems somewhat dangerous at first glance. What if I wanted different sets of allowed columns for different parts of the query? Would I have to provide the…
      throwaway127482 on HN

Alternatives named

  • elixir-dbvisor/sql

    From 2 comments
    • Not really sure what a t string is or if it’s a macro, but feel similar to https://github.com/elixir-dbvisor/sql but less elegant and ergonomic.
      schultzer on HN
    • If your language has macros you can get by as well https://github.com/elixir-dbvisor/sql
      schultzer on HN
  • sqlbind

    From 1 comment
    • I'm author of sqlbind[1] and since t-strings announce have been thinking really hard how to incorporate it. Like obvious cases `t"select * from table where id = {id}"` are…
      bvrmn on HN
  • sqlglot

    From 1 comment
    • Ibis has sqlglot for parsing and rewriting SQL query graphs; and there's sql-to-ibis: https://github.com/ibis-project/ibis/issues/9529 sqlglot: https://github.com/tobymao/sqlglot…
      westurner on HN
  • manifold-sql

    From 1 comment
    • Languages should strive to type safely inline SQL and other structured data. With Java the manifold project achieves this via compiler plugin. The manifold-sql[1] module provides…
      owlstuffing on HN

Category, keywords, summaries and labels on this page were made by AI (Thread Reader v2) and not checked by hand. Each point links to the comments it came from.

Add a badge to your READMEShown on HackerShow
[![Shown on HackerShow](https://hackershow.org/badge.svg)](https://hackershow.org/show/44004827)