Hacker GitHub

← All repos

sqlc-dev/sqlc

View on GitHub ↗ ★ 18,431 Go

Generate type-safe code from SQL

44 mentions on Hacker News by 35 people: 2 stories, 42 comments · first 2019-09-20 · latest 2025-04-17

Mentions per year 44 mentions · busiest year 2021 (13)
20082026
  1. ▲ 5
    Sqlc: Generate type-safe code from SQL
    story by todsacerdoti · 2025-04-17 · 0 comments
  2. What would you use if ORM is to be avoided? Perhaps something like https://github.com/sqlc-dev/sqlc ?
  3. …appropriately to avoid CPU throttling. Good explanation here[6], and solution here[7]. [1]: https://github.com/sqlc-dev/sqlc/issues/ [2]: https://github.com/sqlc-dev/sqlc/issues/3414 [3]: https://github.com/sqlc-dev/sqlc/issues/3394 [4]:…
    comment by imiric · 2024-09-29 · in Some Go web dev notes
  4. …like CASE WHEN @field != "" THEN column = @field ELSE true END. Example from the sqlc creator ( https://github.com/sqlc-dev/sqlc/discussions/364#discussionc... ): -- name: FilterFoo :many SELECT * FROM foo WHERE fk = @fk AND (CASE WHEN…
    comment by benhoyt · 2024-09-10 · in Sqlc: Compile SQL to type-safe code
  5. I've been looking into sqlc lately for Go. Seems brilliant except for the lack of dynamic queries: https://github.com/sqlc-dev/sqlc/discussions/364
    comment by pier25 · 2024-09-09 · in Sqlc: Compile SQL to type-safe code
  6. I can't find an equivalent for Go. https://github.com/sqlc-dev/sqlc and https://github.com/sqlc-dev/sqlc look nice, but they are doing codegen, definitely not as sleek as Rust sqlx. I guess it's a good example of how powerful Rust is. The…
  7. If you want to try out something cool, check out https://github.com/sqlc-dev/sqlc It's written in Go and it converts your sql migrations and queries into typesafe code that you use access your database. It currently has a plugin for Python…
    comment by impulser_ · 2023-08-14 · in Python: Just Write SQL
  8. Some examples for anyone else reading: Go: https://github.com/kyleconroy/sqlc Rust: https://github.com/cornucopia-rs/cornucopia This is my preferred method of interacting with databases now, if available. Very flexible.
    comment by w7 · 2023-06-28 · in Is ORM still an anti-pattern?
  9. …in looking up sqlc for python but it seems to be for go? Is there a different version than this? https://github.com/kyleconroy/sqlc
    comment by jerrygenser · 2023-04-29 · in Deno 1.33: Deno 2 is coming
  10. …(after a redirect from github.com). There's going to be a lot of broken builds today: $ curl -i -L https://github.com/kyleconroy/sqlc/releases/download/v1.17.0/sqlc_1.17.0_linux_amd64.tar.gz HTTP/2 302 server: GitHub.com date: Fri, 24 Mar…
  11. Why don't you use sqlc + pgx? What's missing from the two? https://github.com/kyleconroy/sqlc https://github.com/jackc/pgx
    comment by Thaxll · 2023-03-20 · in Why use Rust on the back end?
  12. …of course. You write your SQL queries in file, and it generates type safe bolierplate for you. https://github.com/kyleconroy/sqlc
    comment by GeorgeHoneywood · 2023-01-25 · in You might not need an ORM
  13. Would this do? https://github.com/kyleconroy/sqlc
    comment by pstuart · 2022-09-29 · in Flyweight: An ORM for SQLite
  14. …sqlc[0] is leagues better than any ORM in terms of simplicity, complexity and maintainability. 0: https://github.com/kyleconroy/sqlc
  15. …without too much extra toil). Last I checked they're also working on adding sqlite support. https://github.com/kyleconroy/sqlc/
  16. …being written in Go, it does look like these folks also want to do the same thing for TypeScript. https://github.com/kyleconroy/sqlc/issues/296 Given the success of packaging other Go and Rust tools into npm, like esbuild, I suspect it’s…
  17. FWIW for SQL, sqlc[1] is probably the nicest SQL layer I've used in any language. [1] https://github.com/kyleconroy/sqlc
    comment by alecthomas · 2022-02-04 · in Go performance from version 1.2 to 1.18
  18. …link to this issue as I couldn't see anything in official docs unless looking at the github issues. https://github.com/kyleconroy/sqlc/issues/1157
  19. …documentation and actually there's a discussion on github containing queries with join statements: https://github.com/kyleconroy/sqlc/issues/213
  20. …and also really liked the approach. Unfortunately I had to drop it temporarily due to this issue ( https://github.com/kyleconroy/sqlc/pull/983 )... which I now see is solved. Taking another look. :)
  21. …statement. That... is a problem. Looks like there is an open discussion about this on the project: https://github.com/kyleconroy/sqlc/discussions/1149
  22. …That merge was 1.5 yr ago though, and I am curious what the plans are to take that further. [0] https://github.com/kyleconroy/sqlc/pull/331
  23. …libraries, but the caveats section gives me pause. Needing to use arrays for the IN use case (see https://github.com/kyleconroy/sqlc/issues/216 ) and the bulk insert case feel like large divergences from what "idiomatic SQL" looks like. It…
  24. …well worth checking out sqlc. It parses your migrations to generate typed structs and query funcs https://github.com/kyleconroy/sqlc
    comment by Andys · 2021-08-29 · in Show HN: Typed Postgres CRUD Queries
  25. Doing it the other way around makes more sense, i.e. write SQL to generate code. See https://github.com/kyleconroy/sqlc , why aren't more people following this approach?
  26. https://github.com/kyleconroy/sqlc
  27. I've enjoyed using https://github.com/kyleconroy/sqlc on a couple of projects. Give it your schema and queries, get type-safe interfaces in return. It's a happy medium for me between all-in ORM and raw SQL.
  28. …the mapping between database rows and Go structs. [1]: https://github.com/jschaf/pggen [2]: https://github.com/kyleconroy/sqlc
  29. SQLC could be a good fit. It generates type-safe Go code from SQL. https://github.com/kyleconroy/sqlc
  30. …something I consider to be practical in today's fast paced environments. After sqlx, I gave sqlc ( https://github.com/kyleconroy/sqlc ) a try and I found it to be much more painless than any other database solution (for PostgreSQL) for…
    comment by ashutoshgngwr · 2021-01-08 · in How to Work with Postgres in Go Artemiy Ryabinkov
  31. …it is amazing. Only issue it only supports postgres, although it has beta support for other DBs. https://github.com/kyleconroy/sqlc SQLx is good for simple read queries, but iirc for write operations you still need to map things manually…
    comment by brunoluiz · 2020-11-07 · in Go in Production – Lessons Learned
  32. …idiomatic Go code from SQL". It makes sense to generate code from SQL and not the other way around. https://github.com/kyleconroy/sqlc
  33. Go has something similar to this https://github.com/kyleconroy/sqlc
    comment by icholy · 2020-08-13 · in Simple SQL in Python
  34. This is similar to sqlc for Golang: https://github.com/kyleconroy/sqlc If you're looking for the ability to generate type-safe SQL – given you write SQL correctly – this project is pretty good. Aalso a fan of SQLBoiler (…
  35. A better equivalent in Go is https://github.com/kyleconroy/sqlc
  36. …future, so it's great to see that others in the TypeScript community find this workflow useful. [0] https://github.com/kyleconroy/sqlc
  37. I maintain an open source project with ~2k stars ( https://github.com/kyleconroy/sqlc ). There’s a large list of bug reports and feature requests, but since I don’t work on it full time, I’ve gotten really good at saying “No” and “I’m…
  38. …supports PostgreSQL, but the plan is to support more engines and more output programming languages. https://github.com/kyleconroy/sqlc
    comment by conroy · 2020-04-05 · in Ask HN: What are you learning?
  39. …Go and PostgreSQL are currently supported, with Kotlin and MySQL support on the way. https://github.com/kyleconroy/sqlc
  40. ▲ 3
    Sqlc: Compile SQL to type-safe Go (Kotlin and TypeScript planned)
    story by ivanfon · 2020-02-24 · 0 comments
  41. Very cool! I maintain a similar tool: sqlc https://github.com/kyleconroy/sqlc In addition to catching SQL errors, it generates type-safe Go wrapping code. Right now it supports PostgreSQL and MySQL. I’m (obviously) a huge fan of the SQL…
    comment by conroy · 2020-01-13 · in Catching SQL errors at build time
  42. It absolutely could, although it doesn't yet. You can track progress by following this issue: https://github.com/kyleconroy/sqlc/issues/28
  43. …), so I wrote my own for PostgreSQL. It takes existing queries and generates type-safe Go methods ( https://github.com/kyleconroy/sqlc ). I enjoy using it and thought others might too. As for migrations, I've had success with…
    comment by conroy · 2019-11-08 · in Go Turns 10
  44. …for your queries, automatically. It’s made a dramatic difference in my day-to-day workflow. [0] https://github.com/kyleconroy/sqlc