frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

Pony: An actor-model, capabilities-secure, high-performance programming language

https://www.ponylang.io/discover/
116•RossBencina•4h ago•66 comments

Sign in with Google in Chrome

https://underpassapp.com/news/2025/7/5.html
373•frizlab•14h ago•204 comments

I designed my own fast game streaming video codec – PyroWave

https://themaister.net/blog/2025/06/16/i-designed-my-own-ridiculously-fast-game-streaming-video-codec-pyrowave/
345•Bogdanp•14h ago•103 comments

Copyparty – Turn almost any device into a file server

https://github.com/9001/copyparty
781•saint11•19h ago•126 comments

Tao on “blue team” vs. “red team” LLMs

https://mathstodon.xyz/@tao/114915604830689046
460•qsort•19h ago•146 comments

Rotring 600 Ballpoint Pen

https://www.shellshore.com/review-rotring-600-ballpoint-pen/
95•Alupis•3d ago•75 comments

Exploiting zero days in abandoned hardware

https://blog.trailofbits.com/2025/07/25/exploiting-zero-days-in-abandoned-hardware/
16•ingve•3d ago•1 comments

50x rendering speed improvements in Hologram (Elixir web framework)

https://hologram.page/blog/hologram-v0-5-0-released
14•bartblast•3d ago•13 comments

Truchet Tiles

https://en.wikipedia.org/wiki/Truchet_tiles
38•downboots•3d ago•8 comments

Different Clocks

https://ianto-cannon.github.io/clock.html
187•pppone•15h ago•33 comments

Tour de France confronts a new threat: Are cyclists using tiny motors?

https://www.washingtonpost.com/world/2025/07/25/tour-france-bikes-hidden-motors/
62•bookofjoe•3d ago•108 comments

SQLx – Rust SQL Toolkit

https://github.com/launchbadge/sqlx
156•stmw•3d ago•63 comments

Claude Code weekly rate limits

515•thebestmoshe•16h ago•616 comments

Show HN: Use Their ID – Use your local UK MP’s ID for the Online Safety Act

https://use-their-id.com/
720•timje1•12h ago•211 comments

Enough AI copilots, we need AI HUDs

https://www.geoffreylitt.com/2025/07/27/enough-ai-copilots-we-need-ai-huds
873•walterbell•1d ago•245 comments

Simplify, then add delightness: On designing for children

https://shaneosullivan.wordpress.com/2025/07/28/on-designing-for-children/
167•shaneos•19h ago•61 comments

Built a rickroll machine that rickrolls you with microservices

https://github.com/nabbonoushad/Chaotic-Rickroll-Machine
20•darad•4d ago•11 comments

The EU could be scanning your chats by October 2025

https://www.techradar.com/computing/cyber-security/the-eu-could-be-scanning-your-chats-by-october-2025-heres-everything-we-know
199•saubeidl•3h ago•156 comments

Show HN: Companies use AI to take your calls. I built AI to make them for you

https://www.pipervoice.com/
91•michaelphi•12h ago•78 comments

GLM-4.5: Reasoning, Coding, and Agentic Abililties

https://z.ai/blog/glm-4.5
206•GaggiX•20h ago•107 comments

Fintech dystopia

https://fintechdystopia.com/
210•LasEspuelas•8h ago•182 comments

The Useless UseCallback

https://tkdodo.eu/blog/the-useless-use-callback
88•0xedb•13h ago•68 comments

The Vatican observatory looks to the heavens

https://www.newyorker.com/magazine/2025/08/04/the-vatican-observatory-looks-to-the-heavens
56•pseudolus•12h ago•13 comments

Terminal app can now run full graphical Linux apps in the latest Android Canary

https://www.androidauthority.com/linux-terminal-graphical-apps-3580905/
204•thunderbong•3d ago•90 comments

Cells that breathe oxygen and sulfur at the same time

https://www.quantamagazine.org/the-cells-that-breathe-two-ways-20250723/
74•sohkamyung•3d ago•4 comments

How to make websites that will require lots of your time and energy

https://blog.jim-nielsen.com/2025/how-to-make-websites-that-require-lots-of-time-and-energy/
268•OuterVale•1d ago•223 comments

Modernising the Amiga at Forty

https://benjamin.computer/posts/2025-07-28-amiga40.html
4•freediver•4h ago•0 comments

SRAM Has No Chill: Exploiting Power Domain Separation to Steal On-Chip Secrets

https://cacm.acm.org/research-highlights/sram-has-no-chill-exploiting-power-domain-separation-to-steal-on-chip-secrets/
65•zdw•3d ago•23 comments

Robot hand could harvest blackberries better than humans

https://news.uark.edu/articles/79750/robot-hand-could-harvest-blackberries-better-than-humans
99•PaulHoule•14h ago•57 comments

Principles for production AI agents

https://www.app.build/blog/six-principles-production-ai-agents
105•carlotasoto•18h ago•14 comments
Open in hackernews

SQLx – Rust SQL Toolkit

https://github.com/launchbadge/sqlx
156•stmw•3d ago

Comments

tmpfs•3d ago
I have used this as well as many of the other lower-level db drivers (which don't check your SQL at compile time) and I can say I much prefer the latter.

My issues with SQLx when I first tried it were that it was really awkward (nigh impossible) to abstract away the underlying DB backend, I expect those issues are fixed now but for some simple apps it's nice to be able to start with SQLite and then switch out with postgres.

Then I wanted to dockerize an SQLx app at one point and it all becomes a hassle as you need postgres running at compile time and trying to integrate with docker compose was a real chore.

Now I don't use SQLx at all. I recommend other libraries like sqlite[1] or postgres[2] instead.

SQLx is a nice idea but too cumbersome in my experience.

[1]: https://docs.rs/sqlite/latest/sqlite/ [2]: https://docs.rs/postgres/latest/postgres/

vegizombie•3d ago
It's definitely not perfect, but I think both of those issues are better now, if not fully solved.

For needing a DB at compile time, there's an option to have it produce artefacts on demand that replace the DB, although you'll need to connect to a DB again each time your queries change. Even that is all optional though, if you want it to compile time check your queries.

stmw•2d ago
Thanks, interesting experience - so much depends on getting developer ergonomics right. There is something to be said for checking the SQL at compile-time, though - esp. if trying to ORM to a typesafe language.
belak•13h ago
I'm have no experience with abstracting away the backend, but Dockerizing is actually pretty easy now - there's an offline mode[1] where you can have sqlx generate some files which let it work when there's no DB running.

[1]: https://docs.rs/sqlx/latest/sqlx/macro.query.html#offline-mo...

0xCMP•13h ago
I know it's annoying (and apparently there is a solution for generating the required files before the build), but in these kinds of situations Go and Rust are great for doing a static build on the system and then copying into a scratch image.

Versus Python and Node often needing to properly link with the system they'll actually be running in.

no_circuit•12h ago
How long ago did you try SQLx? Not necessarily promoting SQLX, but the `query_as` which lets one make queries without the live database macro has been around for 5 years [1].

For lower level libraries there is also the more downloaded SQLite library, rusqlite [2] who is also the maintainer of libsqlite3-sys which is what the sqlite library wraps.

The most pleasant ORM experience, when you want one, IMO is the SeaQl ecosystem [3] (which also has a nice migrations library), since it uses derive macros. Even with an ORM I don't try to make databases swappable via the ORM so I can support database-specific enhancements.

The most Rust-like in an idealist sense is Diesel, but its well-defined path is to use a live database to generate Rust code that uses macros to then define the schema-defining types which are used in the row structs type/member checking. If the auto-detect does not work, then you have to use its patch_file system that can't be maintained automatically just through Cargo [4] (I wrote a Makefile scheme for myself). You most likely will have to use the patch_file if you want to use the chrono::DateTime<chrono::Utc> for timestamps with time zones, e.g., Timestamp -> Timestamptz for postgres. And if you do anything advanced like multiple schemas, you may be out of luck [5]. And it may not be the best library for you if want large denormalized tables [6] because compile times, and because a database that is not normalized [7], is considered an anti-pattern by project.

If you are just starting out with Rust, I'd recommend checking out SeaQl. And then if you can benchmark that you need faster performance, swap out for one of the lower level libraries for the affected methods/services.

[1] https://github.com/launchbadge/sqlx/commit/47f3d77e599043bc2...

[2] https://crates.io/crates/rusqlite

[3] https://www.sea-ql.org/SeaORM/

[4] https://github.com/diesel-rs/diesel/issues/2078

[5] https://github.com/diesel-rs/diesel/issues/1728

[6] https://github.com/diesel-rs/diesel/discussions/4160

[7] https://en.wikipedia.org/wiki/Database_normalization

adelmotsjr•11h ago
Why would you want to abstract away the underlying database? Wouldn't it better to already use the target DB to cattch potential issues earlier? Also to avoid creating another layer of indirection, potentially complecting the codebase and reducing performance?
TrueDuality•9h ago
Primarily for libraries and deployment environments that aren't fully in your control which is still pretty common once you get to B2B interactions, SaaS is not something you can easily sell to certain environments. Depending on the assurance you need, you might even need to mock out the database entirely to test certain classes of database errors being recoverable or fail in a consistent state.

Even in SaaS systems, once you get large enough with a large enough test suite you'll be wanting to tier those tests starting with a lowest common denominator (sqlite) that doesn't incur network latency before getting into the serious integration tests.

thesuperbigfrog•13h ago
I used SQLx with an SQLite database and ran into connection pool problems that would cause the database to be unexpectedly dropped.

The issues I saw seem to be related to these issues:

https://github.com/launchbadge/sqlx/issues/3080

https://github.com/launchbadge/sqlx/issues/2510

The problems did not manifest until the application was under load with multiple concurrent sessions.

Troubleshooting the issue by changing the connection pool parameters did not seem to help.

I ended up refactoring the application's data layer to use a NoSQL approach to work around the issue.

I really like the idea of SQLx and appreciate the efforts of the SQLx developers, but I would advise caution if you plan to use SQLx with SQLite.

zbentley•13h ago
As a total outsider to sqlx, those issues don’t surprise me: any application on any platform that uses a SQLite in-memory DB concurrently is likely to violate many assumptions made by client-side connection pooling tools. In-memory SQLite is a great tool, but using it indirectly behind a connection pooler that assumes the database is external to the current process is bound to cause problems.
stmw•8h ago
Agree with zbentley, I actually wouldn't expect this to work well - perhaps a good thing for sqlx team to warn against.
cortesi•6h ago
SQLx is great, but I had a long laundry list of issues with its SQLite support so I forked it into a focused SQLite-specific library. It has now diverged very far from SQLx, and the number of small inaccuracies and issues we fixed in the low-level SQLite bindings is well into the dozens. The library is unannounced, but is already being used in some high-throughput scenarios.

https://github.com/cortesi/musq

bitbasher•13h ago
I've been using sqlx with postgres for several months now on a production server with decent query volume all day long. It has been rock solid.

I find writing sql in rust with sqlx to be far fewer lines of code than the same in Go. This server was ported from Go and the end result was ~40% fewer lines of code, less memory usage and stable cpu/memory usage over time.

jchw•13h ago
Speaking of Go, if you want compile-time type checking like what SQLx offers, the Go ecosystem has an option that is arguably even better at it:

https://sqlc.dev/

It has the advantage that it implements the parsing and type checking logic in pure Go, allowing it to import your migrations and infer the schema for type checking. With SQLx you need to have your database engine running at compile time during the proc macro execution with the schema already available. This makes SQLx kind of a non-starter for me, though I understand why nobody wants to do what sqlc does (it involves a lot of duplication that essentially reimplements database features.) (Somewhat ironically it's less useful for sqlc to do this since it runs as code generation outside the normal compilation and thus even if it did need a live database connection to do the code generation it would be less of an impact... But it's still nice for simplicity.)

bitbasher•12h ago
It's possible to run sqlx in 'offline' mode that uses your schema to do the checks so you don't need a live database. That's a popular option in CI/CD scenarios.
echelon•9h ago
Offline query caching is great. The team has made it work fantastically for workspace oriented monorepos too.

I ran sqlx / mysql on a 6M MAU Actix-Web website with 100kqps at peak with relatively complex transactions and queries. It was rock solid.

I'm currently using sqlx on the backend and on the desktop (Tauri with sqlite).

In my humble opinion, sqlx is the best, safest, most performant, and most Rustful way of writing SQL. The ORMs just aren't quite there.

I wish other Rust client libraries were as nice as sqlx. I consider sqlx to be one of Rust's essential crates.

bagavi•3h ago
You seem to know your stuff. What's your opinion of diesel?
jjice•7h ago
It's absolutely core to SQLx. I'm surprised to hear that that isn't widely known based on the parent. The first time I used SQLx has to be 4 or 5 years ago and they had it back then.
jchw•6h ago
Well, it hurts that it isn't the default. The README still tells you to set the environment variable, it just isn't the "default" way to do things. In my opinion it would be better to entirely remove support for connecting to the database during compilation. Does anyone actually want to use it that way?

Comparing and contrasting, sqlc type checking happens via code generation, basically the only option in Go since there's nothing remotely like proc macros. Even with code generation, sqlc doesn't default to requiring an actual running instance of the database, though you can use an actual database connection (presumably this is useful if you're doing something weird that sqlc's internal model doesn't support, but even using PostgreSQL-specific features I hadn't really ran into much of this.)

maxbond•3h ago
I think that, if a new user is going to encounter an error, it should be that SQLx couldn't talk to the database rather than that a mysterious file doesn't exist. They're going to need to connect to a dev database either way. They can learn about caching the schema information when they come to those later steps like building a CI pipeline. Early in a project, when your queries and schema are unstable, caching isn't going to be very useful anyway, since you'll be invalidating it constantly.

The sqlc authors are to be applauded for making a static analyzer, that is no small feat. But if you can get away with offloading SQL semantics to the same SQL implementation you plan to use, I think that's a steal. The usability hit is basically free - don't you want to connect to a dev database locally anyway to run end to end tests? It's great to eliminate type errors, but unless I'm missing something, neither SQLx nor sqlc will protect you from value errors (eg constraint violations).

jchw•3h ago
1. I can't tell you how unconvinced I am with the error being less confusing. A good error message tells you what's wrong and ideally what to do to remedy it if possible... and to me there isn't really a practical difference between "set this environment variable" and "run this command". It seems like you basically add one extra step, but you prevent people from choosing a probably suboptimal workflow that they almost certainly don't want to use anyways... Either way, I don't think it's more confusing, and for someone new it's better to only have one way to do something, especially if it's the obviously superior thing anyways.

2. Sure, the database will probably be running locally, when you're working on database stuff. However, the trouble here is that while I almost definitely will have a local database running somehow, it is not necessarily going to be accessible from where the compiler would normally run. It might be in a VM or a Docker container where the database port isn't actually directly accessible. Plus, the state of the database schema in that environment is not guaranteed to match the code.

If I'm going to have something pull my database schema to do some code generation I'd greatly prefer it to be set up in such a way that I can easily wrap it so I can hermetically set up a database and run migrations from scratch so it's going to always match the code. It's not obvious what kinds of issues could be caused by a mismatch other than compilation errors, but personally I would prefer if it just wasn't possible.

maxbond•3h ago
The error message is a fair point, I do still think that making caching the default is premature.

I would definitely recommend writing a Compose file that applies your migrations to a fresh RDBMS and allows you to connect from the host device, regardless of what libraries you're using. Applying your migrations will vary by what tools you use, but the port forwarding is 2 simple lines. (Note that SQLx has a migration facility, but it's quite bare bones.)

solidsnack9000•4h ago
This is not quite the same thing, because it requires `sqlx prepare` to be run first; and that talks to the database to get type information. In SQLC, on the other hand, query parsing and type inference is implemented from first principles, in pure Go.
koito17•2h ago
sqlc's approach has its limitations. Its SQLite query parser is generated from an ANTLR grammar, and I've encountered situations where valid SQLite syntax was rejected by sqlc due to their parser failing.

Type inference was okay, since SQLite barely has any types. The bigger issue I had was dealing with migration files. The nice part about SQLx is that `cargo sqlx database setup` will run all necessary migrations, and no special tooling is necessary to manage migration files. sqlc, on the other hand, hard codes support for specific Go migration tools; each of the supported tools were either too opinionated for my use case or seemed unmaintained. SQLx has built-in tooling for migrations; it requires zero extra dependencies and satisfies my needs. Additionally, inferring types inside the actual database has its benefits: (1) no situations where subsets of valid query syntax are rejected, and (2) the DB may be used for actual schema validation.

For an example of why (2) may be better than sqlc's approach: databases like SQLite sometimes allow NULL primary keys; this gets reflected in SQLx when it validates inferred types against actual database schemas. When I last used sqlc, this potential footgun was never represented in the generated types. In SQLx, this footgun is documented in the type system whenever it can detect that SQLite allows silly things (like NULL primary keys when the PK satisfies certain conditions).

written-beyond•12h ago
I spent 2 weeks trying to build a very basic rest crud API with SQLc and it was not better. I had to shift to SQLx because of how unintuitive SQLc was.
devjab•12h ago
We've been running SQLC in production for a while now and I'm curious which part of it you found unintuitive? We run ours as a container service within the development environment that will compile your code from a postgres dump file. We've had no issues with it at all after the initial configuration guidelines for SQLC, though the documentation certainly isn't exactly great. Hell, I'm not sure I've ever worked with a better SQL to language tool in my decades so I'm surprised that it isn't working out for you.

That being said, as I understand it, SQLx does something very different. If you want dynamic queries, you'll basically have to build that module yourself. The power of SQLC is that anyone who can write SQL can work on the CRUD part of your Go backend, even if they don't know Go. Hell, we've even had some success with business domain experts who added CRUD functionality by using LLM's to generate SQL. (We do have a lot of safeguards around that, to make it less crazy than it sounds).

If you want fancy Linq, grapQL, Odata or even a lot of REST frameworks, you're not getting any of that with SQLC though, but that's typically not what you'd want from a Go backend in my experience. Might as well build it with C# or Java then.

written-beyond•11h ago
It's quite simple really. I want to write a query and have a concrete object as it's return type. The framework that gets me there in the least amount of steps is going to be more intuitive.

Let's compare: SQLC - configuration file (yaml/json) - schema files - query files - understand the meta language in query file comments to generate code you want

SQLx - env: DATABASE_URL

Now does that mean that SQLx is the best possible database framework. No, it does not. Because I didn't spend my time doing things that weren't related to the exact queries I had to write I got more work done.

I want to appreciate the hard work the SQLx Devs have put in to push the bar for a decent SQL developer experience. People give them a really hard time for certain design decisions, pending features and bugs. I've seen multiple comments calling it's compile time query validation "gimmicky" and that's not nice at all. You can go to any other language and you won't find another framework that is as easy to get started with.

bbkane•8h ago
Maybe I'm drinking the sqlc Kool aid, but because I'm already using migration files, setting up the config to point to them and a folder of SQL queries was pretty painless.

And of course now that I have it, the incremental cost of adding a new query is really low as well

devjab•4h ago
> SQLC - configuration file (yaml/json) - schema files - query files - understand the meta language in query file comments to generate code you want

I would recommend using pg_dump for your schema file which means it'll not be related to SQLC as such. This way it will be easier for you to maintain your DB, we use Goose as an example. In our setup part of the pipeline is that you write your Goose migration, and then there is an automated process which will update the DB running in your local dev DB container, do a pg_dump from that and then our dev container instance of SQLC will compile your schema for you.

The configuration file is centralized as well, so you don't have to worry about it.

I agree with you on the SQLC meta language on queries, I appreciate that it's there but we tend to avoid using it. I personally still consider the meta language a beter way of doing things than in-code SQL queries. This is a philosophical sort of thing of course, and I respect that not everyone agres with me on this. It's hard for me to comment on SQLx, however, as I haven't really used it.

What I like about SQLC is that it can be completely de-coupled from your Go code.

happens•12h ago
Interesting - I've had the opposite experience. I usually prefer rust for personal projects, but when I recently tried to use SQLx with sqlite, lots of very basic patterns presented problems, and I wished I had sqlc back.
written-beyond•11h ago
I love it's compile time query validation.
tizzy•12h ago
I never gelled with how SQLC needs to know about your schema via the schema file. I'm used to flyway where you can update the schema as long as it's versioned correctly such that running all the sets of flyways will produce the same db schema.

I referred go-jet since it introspects the database for it's code generation instead.

jchw•11h ago
The way I prefer to use sqlc is in combination with a schema migration framework like goose. It actually is able to read the migration files and infer the schema directly without needing an actual database. This seems to work well in production.
bbkane•8h ago
That's how I'm using it as well (though I'm using some simple migration code instead of a framework): https://github.com/bbkane/enventory/tree/master/app/sqliteco...

I've been quite happy with this setup!

frollogaston•11h ago
This is why I like using NodeJS or Python with SQL, it's very simple to have it not care about the return types. SQL is already statically typed per se, I don't need to re-assert everything. Achieving the same kind of automation in Go etc requires parsing the schema at compile-time like what you described, which is complicated.
solidsnack9000•4h ago
Implementing the parsing and type checking logic in pure Go is not an unqualified advantage. As you point out, it means that SQLC "...essentially reimplements database features..." and in my experience, it does not reimplement all of them.
frollogaston•11h ago
How is it more LoC in Go, just cause of the "if err" stuff?
Thaxll•9h ago
imo sqlc from Go is supperior to sqlx from Rust. The other thing is that sqlx is somehow slow, when I did some test, pgx ( Go ) was faster than sqlx.
j-krieger•1h ago
sqlx pulls in `syn`. Syn is really slow to compile.
hyperbrainer•13h ago
I have never used SQLx, but the best SQL integration I can think of is LINQ. How does this compare to that?
RonanSoleste•13h ago
Different products. I would not compare them. LINQ is more like Diesel (https://diesel.rs/)
maxbond•12h ago
To expand, SQLx isn't an ORM or query builder, what it does is allow you to write raw SQL with compile-time guarantees of type safety. It does this by connecting to a dev database at compile time & uses SQL's introspection features (specifically, by preparing a statement[1]) to analyze your queries. (It can also cache this information to check without a database available, and has a basic migration facility.)

[1] https://github.com/launchbadge/sqlx/blob/main/FAQ.md#how-do-...

S04dKHzrKT•9h ago
In the dotnet world, SQLx is more analogous to F# type providers like FSharp.Data.SqlClient , SQLProvider or Rezoom.SQL.
Ameo•12h ago
sqlx is my favorite way of working with databases in Rust hands down.

I've tried alternatives like Diesel and sea-orm. To be honest, I feel like full-blown ORMs really aren't a very good experience in Rust. They work great for dynamic languages in a lot of cases, but trying to tie in a DB schema into Rust's type system often creates a ton of issues once you try to do anything more than a basic query.

It's got a nice little migration system too with sqlx-cli which is solid.

p4ul•12h ago
This has been exactly my experience! I've found SQLx to be a joy to work with in Rust!
WD-42•12h ago
Same. Never again diesel. The type system just turns it into madness. Sqlx is a much more natural fit.
theOGognf•8h ago
I’ve used Diesel for a bit now but haven’t had issues wrangling the type system. Can you give an example of an issue you’ve encountered?
chuckhend•11h ago
Love SQLx for my Rust projects. I would like to figure out a great way to use the compile time checks in python or js projects, but haven't explored it yet.
OoooooooO•10h ago
I've read the GitHub page but I still have no idea what problems it solves or why I should care about this library?
nbf_1995•10h ago
It's a rust library that you can use to run sql queries against a database. It also inspects the database at compile* time to figure out the type of each column in your query so that your code is type-safe.

* Or in your editor as you're writing code.

nbf_1995•10h ago
SQLx and F# type-providers are probably the best developer experience for writing database access code. I wish more languages had something equivalent.
stmw•8h ago
I think this sort of stuff only comes after a LOT of experience with building SQL db backed systems - it resonated with me immediately. (I'm the OP but not affiliated with this Rust project at all).
moggers123•8h ago
SQLx is great, but I really wish they had a non-async interface. I had to switch a project from sqlx to rusqlite seemingly just due to the overhead of the async machinery. Saw a 20x latency reduction that I narrowed down to "probably async" (sort of hard to tell, I find it very difficult to do perf analysis of async code). I try to avoid discussing async so as to not come off as a frothing-at-the-mouth-chest-thumping-luddite but honestly, if sqlx had a non-async interface I'd be very happy to accept the "you don't need to use it" argument. its the only place where I don't feel like I really have a choice.
karlmdavis•6h ago
I find it kind of baffling that this toolkit is so popular when it makes handling database joins so difficult. After bashing my head against it for a while, I moved to Diesel, and while that has its own set of problems, I am generally able to get through them without resorting to horrible hacks or losing compile time checks.
rellfy•6h ago
What problems have you had with joins? I have this comment in one of my projects:

``` It is required to mark left-joined columns in the query as nullable, otherwise SQLx expects them to not be null even though it is a left join. For more information, see the link below: https://github.com/launchbadge/sqlx/issues/367#issuecomment-... ```

Did you have other problems beyond this, or are you referring to something different?

The issue above is a bit annoying but not enough that I'd switch to an ORM over it. I think SQLx overall is great.

cryptonector•5h ago
What do you mean? It takes SQL queries. You use the `JOIN` keyword in the SQL to do joins.
owlstuffing•6h ago
Quite similar to manifold-sql[1], which is arguably better integrated into Java than SQLx is into Rust. Inline native SQL in Java is *inherently type-safe*, no mapping -- query types, query results, query parameters all projected types at compile-time.

    int year = 2019;
    . . .
    for(Film film: "[.sql/] select * from film where release_year > :rel_year".fetch(year)) {
        out.println(film.title);
    }
1. https://github.com/manifold-systems/manifold/blob/master/man...
banashark•5h ago
One thing I don't usually see addressed with the pure-sql approaches is how to handle dynamic query building. The most common example being large configurable forms that display a data grid. Kysely[1] does a good job of starting from this angle, but allowing something like specifying the concrete deserialization type similar to the libraries here.

I'm a big fan of sql in general (even if the syntax can be verbose, the declarative nature is usually pleasant and satisfying to use), but whenever dynamic nature creeps in it gets messy. Conditional joins/selects/where clauses, etc

How do folks that go all in on sql-first approaches handle this? Home-grown dynamic builders is what I've seen various places I've work implement in the past, but it's usually not built out as a full API and kind of just cobbled together. Eventually they just swap to an ORM to solve the issue.

* [1] https://kysely.dev

zackangelo•4h ago
Is something like SeaQuery[0] what you're talking about?

[0] https://github.com/SeaQL/sea-query/

inbx0•2h ago
SeaQuery looks like a similar dynamic query builder for Rust as Kysely is for JS/TS, so yeah, that'd probably solve the dynamic query problem. But I think parent wasn't so much asking for another library but for patterns.

How do people who choose to use a no-dsl SQL library, like SQLx, handle dynamic queries? Especially with compile-time checking. The readme has this example:

  ...
  WHERE organization = ?
But what if you have multiple possible where-conditions, let's say "WHERE organization = ?", "WHERE starts_with(first_name, ?)", "WHERE birth_date > ?", and you need to some combination of those (possibly also none of those) based on query parameters to the API. I think that's a pretty common use case.
fstephany•1h ago
I agree with you that dynamic query building can be tedious with a pure SQL approach. The use case you are describing can be solved with something alone the lines of:

  WHERE organization = $1
     AND ($2 IS NULL OR starts_with(first_name, $2)
     AND ($3 IS NULL OR birth_date > $3)
With SQLx you would have all the params to be Options and fill them according the parameters that were sent to your API.

Does that make sense?

lovasoa•1h ago
I use a fork of sqlx in SQLPage [1]. I think my main complaint about it is runtime errors (or worse, values decoded as garbage) when decoding SQL values to the wrong rust type.

* [1] https://sql-page.com/

aryonoco•1h ago
If anyone is looking for a similar thing in F#, complete with automatic type generation etc, have a look at SqlHydra.