From: George Moschovitis Date: 2004-10-08T18:09:49+09:00 Subject: Re: [ANN] ndb Object-Relational Mapper Kirk Haines wrote: > On Fri, 8 Oct 2004 01:36:37 +0900, Brian Candler wrote >>That's another O<->R mapping engine? Looks like there's a big >>ecosystem to choose from :-) > In alphabetical order: > Active Record, Criteria, Kansas, Lafcadio, ndb are the five that pop to mind > immediately. There are many O<->R libraries out there, but let me point out where ndb is different: ActiveRecord: this seems to me to be an R->O mapping and not vice versa i think this doesnt use standard ruby objects but something like OpenStruct. Criteria: Uses strange OO query objects Lafcadio: R->O again, you have to write sql definitnions Kansas: the same. n/db: - Uses STANDARD ruby objects ie (O->R mapping) - You write NO SQL table definitions (you can finetune the generated sql schema using a simple metalanguage in ruby) - Because the managed objects are standard objects, you can use inheritance or synthesize your objects using mixins. A number of usefull mixins are provided (for example Child, SqlTreeTraversable (graph preorder pattern) etc). - You can optionally use a unified id space. Ie oids are allocated to different classes of object from the same space. This allows you for example code like the following: class Article .... end class User .... end class Comment .... end a = Article.new u = User.new c1 = Comment.new c1.set_parent(a) $db << c1 c2 = Comment.new c2.set_parent(a) $db << c2 article_comments = $db.children(a, Comment) user_comments = $db.children(u, Comment) - you can automatically deserialize to ruby objects or to resultsets, a future version will support deserialization to OpenStruct objects. - nice support for SQL JOIN operations. - moreover there are some optimizations (for example pregenerated insert/update/deserialize code for each managed class) and more are coming in the next version (prepared statements, stored procedures). - there are some more nice tricks for you to discover until I find time to write proper documentation. I hope more people will have a look at the code, and tell me about problems, and bugs or give suggestions and ideas for improvement. Any cool ideas will be integrated in a future version. regards, George Moschovitis -- www.navel.gr | tel: +30 2106898050 | fax: +30 2106898437 Navel does not accept liability for any errors, viruses or omissions in the contents of this message. The full corporate policy is available on our site. have fun: www.joy.gr