Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[ANN] Object Database Access v 1.0 released

0 views
Skip to first unread message

Hannes Wyss

unread,
Dec 20, 2005, 5:27:15 AM12/20/05
to
Hi all!

Here comes yet another way to map Ruby-Objects to a Relational Database:

ODBA is an unintrusive Object Cache system. It adresses the crosscutting
concern of object storage by disconnecting and serializing objects into
storage. All disconnected connections are replaced by instances of
ODBA::Stub, thus enabling transparent object-loading.

ODBA supports:
* transparent loading of connected objects
* index-vectors
* transactions
* transparently fetches Hash-Elements without loading the entire Hash

An Example:
include 'odba'

#connect default storage manager to a relational database
ODBA.storage.dbi = ODBA::ConnectionPool.new('DBI::pg::database', 'user', 'pw')

class Counter
include ODBA::Persistable
def initialize
@pos = 0
end
def up
@pos += 1
self.odba_store
@pos
end
def down
@pos -= 1
self.odba_store
@pos
end
end

Thanks in advance for any feedback that comes my way!

Cheers
Hannes

--
Mit freundlichen Grüssen / best regards

Hannes Wyss
Konzeption & Entwicklung

pub 1024D/60312B5F 2003-10-09 Hannes Wyss <hw...@ywesee.com>
Key fingerprint = 82D1 90C7 3F3D 93DC F715 4F8B 987A 628E 6031 2B5F

+41 43 540 05 49

www.ywesee.com > intellectual capital connected > www.oddb.org


Hannes Wyss

unread,
Dec 20, 2005, 5:48:40 AM12/20/05
to

Peña, Botp

unread,
Dec 20, 2005, 5:56:14 AM12/20/05
to
Hannes Wyss [mailto:hw...@ywesee.com] :

#raa:
#http://raa.ruby-lang.org/project/odba/
#documentation:
#http://odba.ywesee.com/
#download:
#http://odba.ywesee.com/
#scm:
#http://scm.ywesee.com/?p=odba

1 it sounds great but my dumb brain cannot picture its use and it begs for examples.
2 also, maybe you can give comparison/relation w dbi, yaml, odbc, kirbybase, and other db connectors.


Hannes Wyss

unread,
Dec 20, 2005, 6:33:43 AM12/20/05
to
On Tue, Dec 20, 2005 at 07:56:14PM +0900, Peña, Botp wrote:
>1 it sounds great but my dumb brain cannot picture its use and it begs for examples.
One of the major problems of using a relational database when coding in
ruby, is that a RD severely restricts ruby's flexibility. I believe that
this can generally be said for using relational databases with object
oriented systems. My personal pet peeve however is the fact that with a
relational database, every simple evolution in the code-space must be
reflected in the database schema.
This problem has been addressed by the prevayler project (1) and its
ruby-implementations mnemonic and madeleine (2). I've had the pleasure to
work with both mnemonic and madeleine, but I've also run into problems,
such as:
* huge memory consumption and related performance problems (when the
physical host starts swapping, performance degrades very quickly)
* all actions on your objects must be codified through a Command interface
(this point is actually from http://www.rubygarden.org/ruby?Madeleine
- it's exactly what I mean, but I would never have been able to state
it so precisely)
* implementing search is very hard work
* I came to a point, where taking a snapshot was not possible anymore
(a Stack Overflow Error if I remember correctly)

ODBA tries to solve these issues while keeping the flexibility of the
Object prevalence approach.

I'll try to cook up some good examples and get back to you with them.


1) http://www.prevayler.org
2) http://madeleine.sourceforge.net

Lou Vanek

unread,
Dec 20, 2005, 9:19:44 AM12/20/05
to
Interesting.

How would you do a search?
For example, how would you find all Counters with a pos > 10 but not 13?
Is the search done centrally, or must you download all Counters before
you can do the search?

Hannes Wyss

unread,
Dec 20, 2005, 9:58:11 AM12/20/05
to
Lou

On Tue, Dec 20, 2005 at 11:19:44PM +0900, Lou Vanek wrote:
>How would you do a search?

I'll have to eat my own example here: we've only ever been interested in
string search - i.e. find all users whose last name begins with 'Van':

<example>

require 'odba'
require 'odba/index_definition'

class User
attr_accessor :first_name, :last_name
include ODBA::Persistable
def initialize(first_name, last_name)
@first_name = first_name
@last_name = last_name
end
end

index_def = ODBA::IndexDefinition.new
index_def.index_name = 'users_by_last_name'
index_def.origin_klass = 'User'
index_def.target_klass = 'User'
index_def.resolve_search_term = 'last_name.downcase'

ODBA.storage.dbi = DBI.connect('DBI:pg:test', 'test', '')
ODBA.cache.create_index(index_def, Object)

composer = User.new('Ludwig', 'Van Beethoven')
composer.odba_store
painter = User.new('Vincent', 'Van Gogh')
painter.odba_store
scientist = User.new('Albert', 'Einstein')
scientist.odba_store

ODBA.cache.retrieve_from_index('users_by_last_name', 'van')
-> [composer, painter]

</example>

>For example, how would you find all Counters with a pos > 10 but not 13?
>Is the search done centrally, or must you download all Counters before
>you can do the search?

The numerical Counter#pos case could be done, but is not implemented..

Lou Vanek

unread,
Dec 20, 2005, 10:58:53 AM12/20/05
to
Thanks.

Hannes Wyss

unread,
Dec 21, 2005, 2:20:25 AM12/21/05
to
Botp

>1 it sounds great but my dumb brain cannot picture its use and it begs for examples.

I've put together a couple of code-examples:
http://dev.ywesee.com/wiki.php/ODBA/CodeExamples

now I've got to run - I'll answer all your further questions (my)
tomorrow...

Thanks for your interest!

0 new messages