News for hackers. Stuff that matters.
Re:Getting AI to write good SQL by mritchie712 on Friday May 16, 2025 @09:33PM (#44011364)
The JSON compiles to SQL. Have you used a semantic layer? You might have a different opinion if you tried one.
Re:Getting AI to write good SQL by e3bc54b2 on Saturday May 17, 2025 @01:18AM (#44012209)
As someone who actually wrote a JSON to (limited) SQL transpiler at $DAYJOB, as much fun as I had designing and implementing that thing and for as many problems it solved immediately, 'tail wagging the dog' is the perfect description.
Re:Getting AI to write good SQL by ljm on Sunday May 18, 2025 @09:22AM (#44021252)

    SELECT email FROM users WHERE deleted_at IS NOT NULL OR status = 'active'
seems more semantic to me at first glance than piping this into a JSON->SQL library

    {
      "_select": "email",
      "_table": "users",
      "_where": { 
        "deleted_at": { "_is": { "_not": SQL_NULL_VALUE } },
        "_or": [
          { "status": "inactive" },
        ]
      }
    }
which is usually how these things end up looking.