sqlc icon indicating copy to clipboard operation
sqlc copied to clipboard

Add Ruby support

Open doron050 opened this issue 1 year ago • 4 comments

The ruby ecosystem is very much alive, you can see it in Ruby 2023 ecosystem report by Jetbrains, and as a developer and an SQLC user, I think the project can benefit by supporting as many language runtimes as possible + if there is Python, why not Ruby? :)

@SockworkOrange and I are close to releasing the 1st (though mature) version of our C# plugin, and we want to start working on a ruby one.

doron050 avatar May 18 '24 13:05 doron050

Considering this comment on the corresponding C# issue - "if someone would like to try their hand at C# support, you aren't blocked getting your changes into the sqlc codebase"

@doron050 and I have also started working on adding Ruby support (implemented in Ruby) in here - https://github.com/DaredevilOSS/sqlc-gen-ruby

SockworkOrange avatar Jun 01 '24 08:06 SockworkOrange

Really excited to see this one happen as well. I was going to use https://github.com/jeremyevans/sequel to power it, but honestly haven't put too much thought into the design. Can't wait!

Similar to C#, happy to add this as a community-supported plugin once it's closer to shipping.

kyleconroy avatar Jun 05 '24 00:06 kyleconroy

Our approach in the C# plugin was the officially maintained libs per db (in MySQL for example), or simply the lightweight, most popular lib. I think that adding an additional ORM abstraction like sequel kind of defeats the purpose, no? The comment on using Dapper for C# here summarizes it well.

For example in Ruby, I thought of using:

  • mysql2 for MySQL (see here)
  • pg for PostgreSQL (see here)
  • sqlite3 for Sqlite (see here)

@doron050

SockworkOrange avatar Jun 06 '24 12:06 SockworkOrange

Released first version in here, supporting MySQL & Postgres databases, and generating Ruby3 compatible code.

SockworkOrange avatar Jun 28 '24 17:06 SockworkOrange

@kyleconroy can be closed then:)

SockworkOrange avatar Jul 19 '24 13:07 SockworkOrange