A wish: Simple database

H

Hal Fulton

Hi, all...

I sometimes wish for a very simple database with the
following features:

1. Distributed as part of Ruby
2. Need not store entire db in memory
3. No SQL requirement
4. No special efficiency requirement
5. Available cross-platform
6. Database files are readable cross-platform

Typically I use DBM in this case. But it doesn't
meet (5) and (6), since it's not there on Windows
and the files can't be moved even across Linux
systems.

A simple marshal would be fine, but it violates (2).
I believe PStore would also?

SDBM works by default on Windows, but it is severely
limited if not actually buggy. Probably violates (6)
and (5) also.

Does anyone have any recommendation? Or would a
"universal built-in database" make an interesting
addition to our world?

Not trying to bloat Ruby, just asking.


Hal
 
B

Bill Guindon

Hi, all...

I sometimes wish for a very simple database with the
following features:

1. Distributed as part of Ruby
2. Need not store entire db in memory
3. No SQL requirement
4. No special efficiency requirement
5. Available cross-platform
6. Database files are readable cross-platform

Typically I use DBM in this case. But it doesn't
meet (5) and (6), since it's not there on Windows
and the files can't be moved even across Linux
systems.

A simple marshal would be fine, but it violates (2).
I believe PStore would also?

SDBM works by default on Windows, but it is severely
limited if not actually buggy. Probably violates (6)
and (5) also.

Does anyone have any recommendation? Or would a
"universal built-in database" make an interesting
addition to our world?

Not trying to bloat Ruby, just asking.

Well, there's always xBase.
Yes, I am biased on the topic.
 
J

James Edward Gray II

Hi, all...

I sometimes wish for a very simple database with the
following features:

1. Distributed as part of Ruby
2. Need not store entire db in memory
3. No SQL requirement
4. No special efficiency requirement
5. Available cross-platform
6. Database files are readable cross-platform

I've wished for a similar thing myself. I've had a few different
desires though.

To me is would be handy if each object could be stored in its own data
file, or if I could control the serialization file scheme (not sure
quite how). This especially works if it uses something like YAML, so I
can tweak it a little externally, but still be able to treat it as my
DB inside of Ruby. Would probably be cool if I could choose my output
format too: YAML, XML, or whatever.

That's probably nothing like what you had in mind, but it sounds handy
to me. I've needed something similar more than once.

Anyway, getting back on topic, yes, I like the idea.

James Edward Gray II
 
J

Jamey Cribbs

Hal said:
Hi, all...

I sometimes wish for a very simple database with the
following features:

1. Distributed as part of Ruby
2. Need not store entire db in memory
3. No SQL requirement
4. No special efficiency requirement
5. Available cross-platform
6. Database files are readable cross-platform

Does anyone have any recommendation? Or would a
"universal built-in database" make an interesting
addition to our world?
Well, I have written a pure-Ruby dbms library called KirbyBase
(http://www.netpromi.com/kirbybase.html).

It satisfies features 2 through 6 of your list.

I have recently updated the Ruby version of KirbyBase to 1.8 to keep it
in line with the most recent Python version. I hope to release the new
version soon.

HTH,

Jamey Cribbs

Confidentiality Notice: This email message, including any attachments, is for the sole use of the intended recipient(s) and may contain confidential and/or privileged information. If you are not the intended recipient(s), you are hereby notified that any dissemination, unauthorized review, use, disclosure or distribution of this email and any materials contained in any attachments is prohibited. If you receive this message in error, or are not the intended recipient(s), please immediately notify the sender by email and destroy all copies of the original message, including attachments.
 
W

why the lucky stiff

James said:
To me is would be handy if each object could be stored in its own data
file, or if I could control the serialization file scheme (not sure
quite how). This especially works if it uses something like YAML, so
I can tweak it a little externally, but still be able to treat it as
my DB inside of Ruby. Would probably be cool if I could choose my
output format too: YAML, XML, or whatever.

See YAML::DBM, which comes with Ruby.

require 'yaml/dbm'
YAML::DBM.open( "/tmp/blog" ) do |db|
db['name'] = 'RedHanded'
db['url'] = 'http://redhanded.hobix.com'
db['contact'] = ['(e-mail address removed)', '(e-mail address removed)']
end

YAML::DBM.open( "/tmp/blog" ) do |db|
p db['contact']
end
#=> ['(e-mail address removed)', '(e-mail address removed)']

However, it's a layer on top of DBM, so it doesn't meet Hal's requirements.

_why
 
B

Bill Guindon

Well, I have written a pure-Ruby dbms library called KirbyBase
(http://www.netpromi.com/kirbybase.html).

It satisfies features 2 through 6 of your list.

I have recently updated the Ruby version of KirbyBase to 1.8 to keep it
in line with the most recent Python version. I hope to release the new
version soon.

Interesting, I like the feature set, and the fact that it's pure
Ruby/text. And to top it off, the puppy is cute. :)
 
M

Matt Mower

I sometimes wish for a very simple database with the
following features:

1. Distributed as part of Ruby
2. Need not store entire db in memory
3. No SQL requirement
4. No special efficiency requirement
5. Available cross-platform
6. Database files are readable cross-platform

I'm wishing for something like this right now.

I am using the WordNet database as part of my Rails application
however it seems like overkill to use ActiveRecord (the database isn't
going to change and the queries I want to do are very simple) not to
mention the WordNet database isn't really constructed with
ActiveRecord in mind. However the dataset is too large to use a YAML
file.

With the right database I'd hide the WordNet data behind a simple API.

Regards,

Matt
 
J

James Britt

Hal said:
Does anyone have any recommendation? Or would a
"universal built-in database" make an interesting
addition to our world?

No recommendation (unless someone knows if sqlite files are portable),
but yes, it would make an make an interesting addition.

I'm inclined to think that a lightweight DB falls into the same whatever
category as YAML or XML processing: it's the sort of thing that many
developers will find useful in enough situations that there is an
argument for having it as part the standard library.


James
 
C

Charles Mills

James said:
No recommendation (unless someone knows if sqlite files are portable),
but yes, it would make an make an interesting addition.
They are.
I'm inclined to think that a lightweight DB falls into the same whatever
category as YAML or XML processing: it's the sort of thing that many
developers will find useful in enough situations that there is an
argument for having it as part the standard library.
SQLite meets 2-6 minus 3. However you could create an API above the
SQLite API which didn't require SQL.

-Charlie
 
J

Jamey Cribbs

Shashank said:
Hi Jamey,




In which case, how hard would it be to make it
distributed using dRuby? Just a thought ...
It already is! :)

There is a script in the KirbyBase distribution called kbserver.rb that
uses dRuby to turn KirbyBase into a client/server multi-user dbms.

The reason why I did not include Hal's feature #1 in my earlier email is
that I thought he meant "distributed as part of the standard Ruby
libraries". Maybe I misunderstood. :)

Jamey

Confidentiality Notice: This email message, including any attachments, is for the sole use of the intended recipient(s) and may contain confidential and/or privileged information. If you are not the intended recipient(s), you are hereby notified that any dissemination, unauthorized review, use, disclosure or distribution of this email and any materials contained in any attachments is prohibited. If you receive this message in error, or are not the intended recipient(s), please immediately notify the sender by email and destroy all copies of the original message, including attachments.
 
M

Michael Neumann

Hal said:
Hi, all...

I sometimes wish for a very simple database with the
following features:

1. Distributed as part of Ruby
2. Need not store entire db in memory
3. No SQL requirement
4. No special efficiency requirement
5. Available cross-platform
6. Database files are readable cross-platform

Typically I use DBM in this case. But it doesn't
meet (5) and (6), since it's not there on Windows
and the files can't be moved even across Linux
systems.

A simple marshal would be fine, but it violates (2).
I believe PStore would also?

Something like FSDB?

http://raa.ruby-lang.org/list.rhtml?name=fsdb

Theoretically, it could be imported into Ruby if the author and matz
would agree (and there's need for it in the base distribution).

Regards,

Michael
 
H

Hal Fulton

James said:
I'm inclined to think that a lightweight DB falls into the same whatever
category as YAML or XML processing: it's the sort of thing that many
developers will find useful in enough situations that there is an
argument for having it as part the standard library.

Well, enough people are answering positively that it may be worth
getting Matz's opinion.

Matz: Can we put some kind of standardized trivial database in the
Ruby distribution? If so, what should it be?


Hal
 
H

Hal Fulton

Jamey said:
It already is! :)
There is a script in the KirbyBase distribution called kbserver.rb that
uses dRuby to turn KirbyBase into a client/server multi-user dbms.

The reason why I did not include Hal's feature #1 in my earlier email is
that I thought he meant "distributed as part of the standard Ruby
libraries". Maybe I misunderstood. :)

No, you understood right. Although "distributed" in the
other sense is also interesting, and I had simply not
thought of that.


Hal
 
H

Hal Fulton

Michael said:
Something like FSDB?

http://raa.ruby-lang.org/list.rhtml?name=fsdb

Theoretically, it could be imported into Ruby if the author and matz
would agree (and there's need for it in the base distribution).

I've used FSDB and I like it.

But I was always a little nervous about its disk usage. Is it
excessive?

I know I said I wasn't terribly worried about performance, but
it does need to be *reasonable* in terms of speed and space.


Hal
 
Y

Yukihiro Matsumoto

Hi,

In message "Re: A wish: Simple database"

|See YAML::DBM, which comes with Ruby.

Or YAML::Store, which is PStore with YAML backend, ... but wait, it
stores all data in the memory, so that requirement #2 is not met.
Sigh.

matz.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,169
Messages
2,570,919
Members
47,458
Latest member
Chris#

Latest Threads

Top