Thursday, 13 December 2007

Ruby ORM: DataMapper

There is a relative new ORM (Object Relational Mapper) for Ruby called “DataMapper”. Its goal is to create a fast, feature rich and thread-safe(!) ORM. DataMapper can be used standalone or as plugin for example Rails or Merb.

Finally some competition in the Ruby ORM world. Rails’ ActiveRecord is no longer the only usable production ORM. DataMapper’s developers made some radical different fundamental design decisions regarding to migrations and property declarations. Property declarations are now done in the Model itself and not in separate “migration”-files. Which is more elegant in my opinion.

Lately DataMapper is growing fast, it gets more attention and its feature list gets longer and is already superior to AR in terms of speed. A few weeks ago I started a new project using the new ruby framework Merb. Merb is also thread-safe and is in combination with DataMapper a really cool framework. By the way, did you know Rails is not thread-safe? Kinda sucky for a web framework to handle only one connection at a time. That’s the reason why people use multiple Mongrel servers when deploying Rails application. Not everyone I know seems to realize that. The bad thing is, there is NO plan to make it thread-safe :-/.

Anyway, this post goes more in direction to frameworks now, let’s talk about that in a future post.

Yesterday I submitted my composite indexes patch to DataMapper and they already included it in their SVN trunk. It adds the following new index declaration:


property :name,	:string
property :status,	:integer
property :monitor,	:boolean
property :collected,	:integer
property :kind,		:integer

add_index [:server_id, :name, :collected], :unique => true

Without brackets it creates a separate index for each property and of course :unique can be omitted.


said on Nov. 20, 2008:

(markup will be applied later)



says on Nov. 20, 2008:


    ~ do cool stuff ~

Feeds

Latest Comments

Articles

Links

Blogroll

Gelens.org is powered by: Django 1.0, running on Python 2.5.2 and served by Apache 2.2.9 with mod_wsgi 2.3, proxied by Nginx 0.6.32. The database is PostgreSQL 8.3.4. All of this is running on the latest Arch Linux on a 360MB Linode Xen VPS.