Creating Databases in Ruby

Hello All,

  I was wondering how exactly is the best method for creating
databases in Ruby. I mean databases in a sense of small or large
quantities of information stored.

With Thanks,

···

--
Will Mueller
wce.page.tl
will.liljon@gmail.com

Unless you had a really good reason to do it, this is a fairly solved
problem.
One totally engineered solution is using ActiveRecord by itself with sqlite3
as a DB on the back. This then gives you a nice portable and bundleable
database inside any rails application.

_why had a good post about using sqlite in ruby...

Anyway, 2c

Mikel

···

On Nov 29, 2007 1:48 PM, Will Mueller <will.liljon@gmail.com> wrote:

Hello All,

I was wondering how exactly is the best method for creating
databases in Ruby. I mean databases in a sense of small or large
quantities of information stored.

With Thanks,
--
Will Mueller
wce.page.tl
will.liljon@gmail.com

-------- Original-Nachricht --------

Datum: Thu, 29 Nov 2007 11:48:26 +0900
Von: "Will Mueller" <will.liljon@gmail.com>
An: ruby-talk@ruby-lang.org
Betreff: Creating Databases in Ruby

Hello All,

  I was wondering how exactly is the best method for creating
databases in Ruby. I mean databases in a sense of small or large
quantities of information stored.

With Thanks,
--
Will Mueller
wce.page.tl
will.liljon@gmail.com

Dear Will,

what "best" means is maybe a matter of taste or related
to some particular feature one needs ... :slight_smile:

There are many relational database management systems

... and Ruby has bindings to many of them:

http://raa.ruby-lang.org/search.rhtml?search=database

Just choose one you like :slight_smile:

Best regards,

Axel

···

--
Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
Ideal für Modem und ISDN: GMX Handytarife 2024 | jetzt wechseln & sparen

As the other answers demonstrate this cannot be answered at such a
high level. What kind of data do you want to store? How much of it?
What do you do with the data - is it mostly read only or modified a
lot? With answers to questions like these you will receive much
better targeted replies.

Kind regards

robert

···

2007/11/29, Will Mueller <will.liljon@gmail.com>:

Hello All,

  I was wondering how exactly is the best method for creating
databases in Ruby. I mean databases in a sense of small or large
quantities of information stored.

--
use.inject do |as, often| as.you_can - without end

I've always liked KirbyBase[1]. From its Rubyforge project page:

    KirbyBase is a small, plain-text, DBMS written in Ruby. It can be
used either embedded or client/server.
    It aims to be as "Ruby-ish" as possible. For example, queries are
specified using Ruby code blocks,
    rather than SQL strings.

- Dimitri

[1] http://www.netpromi.com/kirbybase_ruby.html

···

On Nov 29, 2007 3:48 AM, Will Mueller <will.liljon@gmail.com> wrote:

  I was wondering how exactly is the best method for creating
databases in Ruby. I mean databases in a sense of small or large
quantities of information stored.

One or two things to remember: if you aren't dealing with a huge
amount of data, and really just want to store it when you're done (or
periodically), and re-load it when you come back, Marshalling your
data to a file may be a better solution.

If you have data you want transactional file backed, but doesn't map
perfectly to relational models, you may want to try Pstore.

Relational Databases (SQL) are not the panacea of data storage, :slight_smile:
remember your other options!

--Kyle

If you like KirbyBase's interface, you may like Sequel too

http://code.google.com/p/ruby-sequel/

which gives you a Ruby-ish interface, but for your RDBMS of choice.

···

On 11/30/07, Dimitri Aivaliotis <aglarond@gmail.com> wrote:

On Nov 29, 2007 3:48 AM, Will Mueller <will.liljon@gmail.com> wrote:

> I was wondering how exactly is the best method for creating
> databases in Ruby. I mean databases in a sense of small or large
> quantities of information stored.

I've always liked KirbyBase[1]. From its Rubyforge project page:

    KirbyBase is a small, plain-text, DBMS written in Ruby. It can be
used either embedded or client/server.
    It aims to be as "Ruby-ish" as possible. For example, queries are
specified using Ruby code blocks,
    rather than SQL strings.

--
Gerardo Santana

Robert,

  I simply would like to store regular ruby files. An example of this
would be below:

def w
puts "Test"
end

Except I would like to include multiple ruby files. Furthermore having
the ability to bring up the files, such as possibly typing "File."

···

On Nov 30, 2007 6:41 AM, Robert Klemme <shortcutter@googlemail.com> wrote:

2007/11/29, Will Mueller <will.liljon@gmail.com>:
> Hello All,
>
> I was wondering how exactly is the best method for creating
> databases in Ruby. I mean databases in a sense of small or large
> quantities of information stored.

As the other answers demonstrate this cannot be answered at such a
high level. What kind of data do you want to store? How much of it?
What do you do with the data - is it mostly read only or modified a
lot? With answers to questions like these you will receive much
better targeted replies.

Kind regards

robert

--
use.inject do |as, often| as.you_can - without end

--
Will M
wce.page.tl
will.liljon@gmail.com

Kyle Schmitt wrote:

If you have data you want transactional file backed, but doesn't map
perfectly to relational models, you may want to try Pstore.

Sorry to be a pedant, but Atomic != Transactional.

Transactions require the ability to maintain all 4 ACID semantics
even if you pull the power plug in the middle, and even if someone
else is updating an overlapping set of objects. MyISAM is *not*
transactional, for example.

Relational Databases (SQL) are not the panacea of data storage, :slight_smile:
remember your other options!

A proper relational database will give you transactions, and PStore won't.
If that matters to you :-).

Clifford Heath.

Please do not top post.

···

On 01.12.2007 03:08, Will Mueller wrote:

Robert,

  I simply would like to store regular ruby files. An example of this
would be below:

def w
puts "Test"
end

Except I would like to include multiple ruby files. Furthermore having
the ability to bring up the files, such as possibly typing "File."

What does "bring up" mean? What's wrong with using a file system for this? I don't get your use case...

Kind regards

  robert

First of all, what do you mean by "top post"? Do you mean reply on an
email such as this?

And what I mean by "bring up" is simply like the method defined below.
If I would have typed the code I used below, I would be able to see
the text "Test" if I typed "w."

With Thanks,
Will

···

On Dec 1, 2007 4:15 AM, Robert Klemme <shortcutter@googlemail.com> wrote:

Please do not top post.

On 01.12.2007 03:08, Will Mueller wrote:
> Robert,
>
> I simply would like to store regular ruby files. An example of this
> would be below:
>
> def w
> puts "Test"
> end
>
> Except I would like to include multiple ruby files. Furthermore having
> the ability to bring up the files, such as possibly typing "File."

What does "bring up" mean? What's wrong with using a file system for
this? I don't get your use case...

Kind regards

        robert

--
Will M
wce.page.tl
will.liljon@gmail.com

First of all, what do you mean by "top post"? Do you mean reply on an
email such as this?

Yes.

And what I mean by "bring up" is simply like the method defined below.
If I would have typed the code I used below, I would be able to see
the text "Test" if I typed "w."

With Thanks,
Will

What Robert is asking is why you don't just use ruby's built-in
feature for including files and store your many ruby files on the file
system. For example, with a directory like this...

foo
>
`- main.rb
>
`- bar.rb
>
`- baz.rb

...now from main.rb you can just say 'require "bar"' and everything in
bar.rb gets included in main.rb.

What is it about this that is not sufficient, that a database would
solve?

Regards,
Jordan

···

On Dec 1, 4:59 pm, Will Mueller <will.lil...@gmail.com> wrote: