Creating Databases in Ruby

W

Will Mueller

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,
 
M

Mikel Lindsaar

Note: parts of this message were removed by the gateway to make it a legal Usenet post.

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
http://lindsaar.net/
 
A

Axel Etzold

-------- Original-Nachricht --------
Datum: Thu, 29 Nov 2007 11:48:26 +0900
Von: "Will Mueller" <[email protected]>
An: (e-mail address removed)
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,

Dear Will,

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

There are many relational database management systems

http://en.wikipedia.org/wiki/Relational_database

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

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

Just choose one you like :)

Best regards,

Axel
 
K

Kyle Schmitt

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, :)
remember your other options!


--Kyle
 
C

Clifford Heath

Kyle said:
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, :)
remember your other options!

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

Clifford Heath.
 
R

Robert Klemme

2007/11/29 said:
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
 
D

Dimitri Aivaliotis

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.


- Dimitri

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

Gerardo Santana Gómez Garrido

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.

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.
 
W

Will Mueller

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."
 
R

Robert Klemme

Please do not top post.

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
 
W

Will Mueller

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
 
M

MonkeeSage

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
 

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

Forum statistics

Threads
474,271
Messages
2,571,361
Members
48,043
Latest member
BartEaster

Latest Threads

Top