mhakeem
mhakeem

Reputation: 46

Ruby Implicit DB Connection like ActiveRecord

I'm wondering if there is a way to connect and disconnect to a DB implicitly using Ruby like ActiveRecord. I'm working on connecting with Cassandra and the team doesn't want to write the connection lines manually. They just want to give the table name (a.k.a. Column Family) to the class I want to build and move on from there.

I also want to assure that I don't connect and disconnect every time when performing parallel insertions to a table (but disconnect after the whole insertions are finished) since the reconnection process is very expensive and slows down the task.

I couldn't find any solution, and the version that my ex-coworker wrote connects and disconnects after each task like the select statement, and the parallel insert. Any suggestions? A code example of any kind of DB would be very appreciated. Thanks.

NOTE: To clarify, I am using a Cassandra driver. I'm not making an ActiveRecord like ORM for Cassandra, but want to expose APIs where the devs don't have to remember writing connecting and disconnecting lines.

Upvotes: 0

Views: 54

Answers (0)

Related Questions