Kickstarting a database-wg

I'm new to Rust, but have a great deal of experience in Java, C++ and SQL. Where I used to work, we standardized on MyBatis; we had plenty of SQL experience on board, and wanted just a thin layer to eliminate the repetitive boilerplate code. I like the MyBatis approach, but realize different people like different approaches.

So, I'm exploring to see what sort of foundational code Rust has for communicating to databases. I'm not promoting that Rust copy Java, but the Java model has proven very successful, and has permitted a wide variety of approaches to flourish. I'd like to see foundational concepts like drivers and connections implemented in some standardized way, then build up from there to higher level concepts. That will enable all the approaches I'm reading about here, but without having to worry about duplicated effort or incompatibilities at the lower levels.

Maybe all of this has already been done. I'm reading furiously :smile:

2 Likes

Oh, I'm not saying, don't have MyBatis in Rust, or don't have Hibernate.rs, but that you can't have a system that adapts itself to DB perfectly (using runtime checks) and types that are checked at compile-time.

Also, the fact that Rust IDEs are still young, means mixing SQL and Rust code, like what MyBatis does, won't be picked up by rust-analyzer or even a modern IDE like IntelliJ Rust since both hypothetical MyRustBatis library and Rust IDE plugin are relatively young.

Java has the advantage of having such a mature environment, that Java ORMs have relatively good IDE support.

My company and I are very interested in this and would be happy to participate / be involved.

We're currently involved in an effort to make pure Rust async drivers with SQLx. This sounds very similar to everything proposed here and I'd love to discuss any synergy.

2 Likes

It would be relatively simple for the IntelliJ-Rust plugin to support recognizing SQL in strings, but they have to provide patterns for matching function calls for specific crates: https://github.com/intellij-rust/intellij-rust/issues/2231

IDEA Ultimate rolls in a bunch of these by default for Java libraries like jOOQ.

1 Like

Daniel, I agree with all your points. Even in Java, MyBatis has a unique niche: people experienced with SQL looking mostly to interact with existing databases (which may not be amenable to fully automated approaches like Hibernate.) That happened to correspond with our needs and available expertise. Those with different circumstances might be better served by full ORMs. As with all software options, know your environment and your constraints.

That's great, it's just that harmonizing every implementation, will be hard.

How do we sync RDBC and SQLx and various Rust drivers.

That's amazing, and a testament to IntelliJ awesome design. However, that's very specific to IntelliJ and not applicable to those that don't pay for Ulitmate.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.