# Databases with Ruby

**URL:** <https://rubytalk.org/t/databases-with-ruby/73748>\
**Category:** ruby-talk\
**Created:** [10 August 2016 13:11 UTC](https://rubytalk.org/t/databases-with-ruby/73748 "2016-08-10T13:11:07Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![A\_Berger](https://avatars.discourse-cdn.com/v4/letter/a/e9c0ed/32.png) [@A\_Berger](https://rubytalk.org/u/A_Berger)\
**Post date:** [10 August 2016 13:11 UTC](https://rubytalk.org/t/databases-with-ruby/73748/1 "2016-08-10T13:11:07Z")

</div>

Hi  
Which mysql or postgres gems should be used (mysq-\*, mysql2\*, ruby-mysql)  
to interface to the (default) Linux-packages?  
No gems found for postgres???

Is it advisable to use dbi still nowadays? (Does Rails use dbi???)  
- there is an extra gem rails-dbi

What do most/advanced Rubyists use?

What is easier (also to maintain) - for beginners, but suitable for a  
throughput of 10 items (rows) per second?  
Better to bypass dbi in those case?

Thank you!!  
Berg

---

<div class="post-metadata">

**Author:** ![stomar](https://avatars.discourse-cdn.com/v4/letter/s/41988e/32.png) [@stomar](https://rubytalk.org/u/stomar)\
**Post date:** [10 August 2016 13:35 UTC](https://rubytalk.org/t/databases-with-ruby/73748/2 "2016-08-10T13:35:44Z")

</div>

> Which mysql or postgres gems should be used (mysq-\*, mysql2\*,  
> ruby-mysql) to interface to the (default) Linux-packages?

I heard really good things about the "sequel" gem.  
It can handle MySQL, PostgreSQL, SQLite, and many other databases.

> What is easier (also to maintain) - for beginners, but suitable for a  
> throughput of 10 items (rows) per second?

I would guess practically anything would work for such a low throughput.

Regards,  
Marcus

> **···**
>
> Am 10.08.2016 um 15:11 schrieb A Berger:
> 
> --  
> GitHub: [stomar (Marcus Stollsteimer) · GitHub](https://github.com/stomar/)  
> PGP: 0x6B3A101A

---

<div class="post-metadata">

**Author:** ![Aurel\_Branzeanu](https://avatars.discourse-cdn.com/v4/letter/a/b487fb/32.png) [@Aurel\_Branzeanu](https://rubytalk.org/u/Aurel_Branzeanu)\
**Post date:** [10 August 2016 13:13 UTC](https://rubytalk.org/t/databases-with-ruby/73748/3 "2016-08-10T13:13:08Z")

</div>

Hello!

> **···**
>
> On Wed, Aug 10, 2016 at 4:11 PM, A Berger \<aberger7890@gmail.com\> wrote:
> 
> > No gems found for postgres???
> 
> The Postgre gem is 'pg'.
> 
> --  
> Sincerely yours,
> 
> Aurel Branzeanu,
> 
> mailto: branzeanu.aurel@gmail.com  
> Skype: tvorogov  
> GSM Orange: +373 6 940-7700  
> GSM Moldcell: +373 7 940-7700

---

<div class="post-metadata">

**Author:** ![stomar](https://avatars.discourse-cdn.com/v4/letter/s/41988e/32.png) [@stomar](https://rubytalk.org/u/stomar)\
**Post date:** [11 August 2016 15:45 UTC](https://rubytalk.org/t/databases-with-ruby/73748/4 "2016-08-11T15:45:14Z")

</div>

> Is it advisable to use dbi still nowadays? (Does Rails use dbi???)  
> - there is an extra gem rails-dbi

dbi seems to have been a Perl thing (?)

When I understand correctly it provides an extra layer to unify  
the access to different types of databases (via different  
plug-ins or adapters), and also some functionality of an  
object-relational mapper (aka ORM).

You find that approach in various gems:  
Sequel, active\_record, DataMapper, ROM (Ruby Object Mapper), ...

> (Does Rails use dbi???)  
> - there is an extra gem rails-dbi

Rails uses active\_record by default.

rails-dbi seems to be unmaintained for several years,  
and was targeted for Rails 3 -- we now have Rails 5.

Regards,  
Marcus

> **···**
>
> Am 10.08.2016 um 15:11 schrieb A Berger:
> 
> --  
> GitHub: [stomar (Marcus Stollsteimer) · GitHub](https://github.com/stomar/)  
> PGP: 0x6B3A101A

---

<div class="post-metadata">

**Author:** ![Andy\_Jones](https://yyz1.discourse-cdn.com/flex029/user_avatar/rubytalk.org/andy_jones/32/1829_2.png) [@Andy\_Jones](https://rubytalk.org/u/Andy_Jones)\
**Post date:** [11 August 2016 07:45 UTC](https://rubytalk.org/t/databases-with-ruby/73748/5 "2016-08-11T07:45:04Z")

</div>

Sequel is an ORM, so it's a rather different thing. It still requires a database access gem like pg.

It \*is\* good, if you want an ORM (although, personally, I don't get on with the Model framework).

> **···**
>
> > -----Original Message-----  
> > From: ruby-talk [mailto:ruby-talk-bounces@ruby-lang.org] On Behalf Of  
> > sto.mar@web.de  
> > Sent: 10 August 2016 2:36 pm  
> > To: Ruby users  
> > Subject: Re: Databases with Ruby
> > 
> > Am 10.08.2016 um 15:11 schrieb A Berger:  
> > \> Which mysql or postgres gems should be used (mysq-\*, mysql2\*,  
> > \> ruby-mysql) to interface to the (default) Linux-packages?
> > 
> > I heard really good things about the "sequel" gem.  
> > It can handle MySQL, PostgreSQL, SQLite, and many other databases.
> > 
> > \> What is easier (also to maintain) - for beginners, but suitable for a  
> > \> throughput of 10 items (rows) per second?
> > 
> > I would guess practically anything would work for such a low throughput.
> > 
> > Regards,  
> > Marcus
> > 
> > --  
> > GitHub: [stomar (Marcus Stollsteimer) · GitHub](https://github.com/stomar/)  
> > PGP: 0x6B3A101A
> > 
> > Unsubscribe: \<mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe\>  
> > \<[http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk&gt](http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk&gt);
> 
> Click here to view Company Information and Confidentiality Notice.\<[http://www.jameshall.co.uk/index.php/small-print/email-disclaimer&gt](http://www.jameshall.co.uk/index.php/small-print/email-disclaimer&gt);

---

<div class="post-metadata">

**Author:** ![stomar](https://avatars.discourse-cdn.com/v4/letter/s/41988e/32.png) [@stomar](https://rubytalk.org/u/stomar)\
**Post date:** [11 August 2016 15:10 UTC](https://rubytalk.org/t/databases-with-ruby/73748/6 "2016-08-11T15:10:04Z")

</div>

Granted. Depends on what the OP exactly wants to do.

Personally, I like the extra bit of abstraction.  
And of course, you are not forced to use Sequel::Model  
and can also any time run raw SQL queries, too,  
if you prefer.

Regards,  
Marcus

> **···**
>
> Am 11.08.2016 um 09:45 schrieb Andy Jones:
> 
> > Sequel is an ORM, so it's a rather different thing. It still requires a database access gem like pg.
> > 
> > It \*is\* good, if you want an ORM (although, personally, I don't get on with the Model framework).
> 
> --  
> GitHub: [https://github.com/stomar/](https://github.com/stomar/)  
> PGP: 0x6B3A101A
