Hacker News new | past | comments | ask | show | jobs | submit login
Sequel: The Database Toolkit for Ruby (github.com/jeremyevans)
63 points by thunderbong 15 days ago | hide | past | favorite | 36 comments



To me, the best part about sequel is that it works with jruby. I use it as a secret weapon when I need a db automation that runs practically anywhere thanks to JVM (and thanks to Jeremy).


> db automation that runs practically anywhere thanks to JVM

Doesn't both JRuby and CRuby require you to download platform specific executable? Or does JRuby offer a portable standalone executable? If that is the case then I might also switch.


You don't want to distribute JRuby's executable, or your ruby code. To release, what you want to do is to compile your program and all its dependencies (including JRuby's jar file) into a single jar using something like warbler. This also acts as a layer of obfuscation, since JRuby produces code that generates classes dynamically, so it will all look very ugly to the human eye.

Oh I see, thank you!

You can download the complete JRuby JAR, which will run happily anywhere you have a JVM.


It's been years since I investigated it but isn't ActiveRecord running in JRuby these days?


Yes, rails targets jruby, so it should be possible to accomplish something similar with activerecord as well. I just like Sequel the way I like Sinatra.


Greetings from another Sinatra lover!


Are you saying it is compitable with JRuby (using a adapter) nowadays or are you saying ActiveRecord runs in a JRuby process when running Rails?


It was a honest question, I was curious if, using JRuby, I could use ActiveRecord as an ORM instead of Sequel. I am not challenging any preference towards Sequel.


I wasn't sure about how I should interpret your question or if it was statement, that's why I asked.

Yes, you can use the jdbc adapter made by the JRuby team! https://github.com/jruby/activerecord-jdbc-adapter

Though, in my opinion, the best combo has been Sinatra + Sequel.


Yes you can use either.

I think you might be slightly more limited in your choice of database drivers compared to MRI Ruby but I believe there’s a JDBC driver that should fill the gap.


This is what I reach for whenever I'm not using ActiveRecord in Ruby. Excellent library—difficult to talk about over audio.


> difficult to talk about over audio

:-) Yes, I've had the same problem! They might as well have named the project "The word sequel, as in the next thing, not Ess Cue Ell."


I used this a lot when I wasn't doing any other Ruby at the time, to do some more involved SQL automatization and ETL. I tried to stick with SQL/psql as much as possible, but if that fails or would've lead too much into temporary tables and pl/sql, I went with Sequel. I could fiddle around it in an interactive REPL if I wanted to, and the resulting code wasn't too OO so that the underlying Postgres representation was barely visible.

Some day I might try my hand at a "full Jeremy Evans" stack backend, i.e. both Sequel and his web framework Roda, authentication with Rodauth etc.


I really like Sequel and use it as well in non rails apps. Its powering pg-osc and pg_easy_replicate for me. Thanks for the project!


This is probably my favorite gem of all time. I strongly prefer it to active record. Especially when I have to do any sort of complex query.


[flagged]


Not the OP, but the number of people actually knowing about it and/or using it is quite low, and I feel it is one of the most underrated & powerful libraries in the Ruby world!


Really? That totally changes my assumption. I thought it was a well known gem. I reach out to when whenever I want to automate some database related tasks OR when I want to know if there is a better way to write a sql query.


Most Rubyists I know barely know it (well they have "heard" of it, but not actually used it)!

They are missing out!

Hell yes :-)

For the record, I am a deep Sequel fan, and wrote ETL connectors that use it:

https://www.kiba-etl.org/kiba-pro

https://github.com/thbar/kiba/wiki#kiba-pro (full doc with snippets)

It is one of the most underrated gems of the Ruby universe IMO!




[flagged]


Not everyone pronounces SQL as 'sequel,' since it is a known acronym, so don't go thinking that's widely accepted because a vocal bunch on YouTube says 'sequel.'

Still, it was dumb to name another project that.


So, "sequel" as a name, as opposed to "ess-cue-ell" is pretty universally used in English. Most people who use it call the Microsoft RDBMS "sequel server" not "ess-cue-ell server" and I hear "sequel" slightly more than spelling out the acronym these days. The UK does tend to prefer to make a word out of an acronym though, so we tend to say things like OS (Operating System) as "oss" not "oh-ess". This led me in a conversation once to only realise at the end that the guy was talking about "RTOS" (which I had only ever read, and used the more American "AR-TEE-OH-ESS") when he was saying "are-toss".

Edited to clarify we are talking about English usage because apparently, someone speaking French down voted me because French is not English..


Not sure if you saw my other comment, but I still disagree that it is "universal" based on my own experience of frequently hearing S Q L as opposed to 'sequel' from English-speaking peers. It's honestly a super interesting thing to explore, if you ask me. I am sure there are multiple cultural and linguistic influences at play, though I am not versed enough if either of those fields to say exactly how. Has there been any data/research on this, that you know of?


I've also heard a bunch of people saying "ess-cue-ell" rather than "sequel" (in English). Probably as many as I've heard saying "sequel".

I don't think neither is "universal". Personally I switch between them depending on my current mood.


Yeah - it is complicated. I had never heard "sequel" till I started my first day job in the late 90's. But I swear the closer people are to databases management, the more I hear "sequel". SQL being spelled out is seemingly more people new to databases or used interchangeably like everyone has identified. I do say it either way, but I would always say "Sequel Server" for example.

I guess when I say "universal", I never hear someone say "what is that?" I mean - most programmers understand the term. I favour it as it seems easier to say.


> So, "sequel" as a name, as opposed to "ess-cue-ell" is pretty universally used

Nope - 100% of French speakers pronounce it "ess-cue-ell".


I wasn't talking about French speakers. We are speaking about English usage. I have heard French people say "Sourcecodes" or "Sources" too, but that is also something I would never personally use in English. Sourcecode is uncountable, so it is already implicitly multiple things, so plural is redundant.


As another data point - I’ve never looked at YouTube for database content, but every single DBA I’ve encountered in the corporate world pronounces SQL as ‘sequel’.


Anecdotal, but fair, since I can say the opposite. I've largely heard it said as S Q L, ro the point when someone verbally calls it "sequel" it takes me an extra moment to remember what they are referring to. I rationalize it thus; we don't make words from our other acronyms that aren't already pronouncable words to some degree. Exploring that, we don't say "fibby" when we mean FBI or "see ya" when we mean CIA (maybe we should, though?). DARPA, on the other hand, is pronouncable on its own, so we'll say the word instead of D A R P A. Another one is HIPAA, which is interesting, since its pronouncable, but people often get the acronym wrong as HIPPA when writing/typing it (FAFSA being another good example) although that is more US-centric.

Anyway, our treatment of saying the word instead of saying the letters of the acronym is interesting to think about, I guess. I reckon there's a lot of cultural and linguistic influence there. Perhaps someone smarter than me can unpack it.


It is interesting. I always thought it began as ’sequel’ and was then abbreviated, but I wasn’t around when it started back in the 1960’s or whenever that was… might go google it haha


This always annoyed me ~10 years ago when I picked up a few sequel projects. It was such a pain in the ass to google when I was stuck on things


Back in 2014 I had a lot of luck finding what I needed using "sequel ruby" as the search term instead of just using sequel which was indeed abysmal. Adding context in search just gives better results overall.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: