Forum: Ruby Does Ruby has any default database with it?

Posted by Love U Ruby (my-ruby)
on 2013-01-30 19:21
I will do webpage scraping using Ruby and required Gems. But looking for
a capable database into which I can store the data,which I will fetch
from the script.

Thus asking if Ruby has any inbuilt one or suggest me if any open-source
DB,which is capable with Ruby?

Thanks
Posted by Brandon Weaver (Guest)
on 2013-01-30 19:24
(Received via mailing list)
Normally sqlite is the go to being that it's the default of rails. Check
into sequel.
Posted by Colby Callahan (Guest)
on 2013-01-30 19:55
(Received via mailing list)
Doesn't Rails come with a built in database called Brick?  No additional
set up required.  Supposed to be out of the box I believe.


Colby
Posted by Love U Ruby (my-ruby)
on 2013-01-30 19:57
Colby Callahan wrote in post #1094420:
> Doesn't Rails come with a built in database called Brick?  No additional
> set up required.  Supposed to be out of the box I believe.
>
>
> Colby


But I need with Ruby 1.9.3. I am not a ROR developer.

Thanks,
Posted by Hassan Schroeder (Guest)
on 2013-01-30 20:06
(Received via mailing list)
On Wed, Jan 30, 2013 at 10:54 AM, Colby Callahan
<colby.callahan@gmail.com> wrote:
> Doesn't Rails come with a built in database called Brick?  No additional set
> up required.  Supposed to be out of the box I believe.

No, you might be thinking about WEBrick, the web server that's a
default Rails component, but that's totally irrelevant to the OP's
question.

To the OP: you can use MySQL, SQLite, PostgreSQL, etc.

Also, MagLev has built-in object persistence, but it's still at 1.8.7.
Posted by Love U Ruby (my-ruby)
on 2013-01-30 20:10
Hassan Schroeder wrote in post #1094424:
> On Wed, Jan 30, 2013 at 10:54 AM, Colby Callahan
> <colby.callahan@gmail.com> wrote:
>> Doesn't Rails come with a built in database called Brick?  No additional set
>> up required.  Supposed to be out of the box I believe.
>
> No, you might be thinking about WEBrick, the web server that's a
> default Rails component, but that's totally irrelevant to the OP's
> question.
>
> To the OP: you can use MySQL, SQLite, PostgreSQL, etc.

@Hassan

Are all of the above - "MySQL, SQLite, PostgreSQL" open-source? Any good 
documentation to use with "SQLite, PostgreSQL" would you like to prefer?

Thanks
Posted by Brandon Weaver (Guest)
on 2013-01-30 20:17
(Received via mailing list)
http://sequel.rubyforge.org/

Fairly sure MySQL and Sqlite are OS. Then again, much more than that and
you really should be googling for documentation to these types of 
things.
Posted by Hassan Schroeder (Guest)
on 2013-01-30 20:25
(Received via mailing list)
On Wed, Jan 30, 2013 at 11:10 AM, Arup Rakshit <lists@ruby-forum.com> 
wrote:
>
> Are all of the above - "MySQL, SQLite, PostgreSQL" open-source?

Yes. Really, the choice depends on your use case(s), platform, and
personal preference so I'd just try them all  :-)

Good luck.
Posted by Love U Ruby (my-ruby)
on 2013-01-30 20:28
Hassan Schroeder wrote in post #1094429:
> On Wed, Jan 30, 2013 at 11:10 AM, Arup Rakshit <lists@ruby-forum.com>
> wrote:
>>
>> Are all of the above - "MySQL, SQLite, PostgreSQL" open-source?
>
> Yes. Really, the choice depends on your use case(s), platform, and
> personal preference so I'd just try them all  :-)
>
> Good luck.


I need 4 tables with more or less 40,000 rows in each,which must be 
capable of producing report data as export in excel or CSV. Need to run 
all kind of SQl queries into it,to get rows.

Thanks
Posted by Justin Collins (Guest)
on 2013-01-30 21:07
(Received via mailing list)
On 01/30/2013 10:21 AM, Arup Rakshit wrote:
> I will do webpage scraping using Ruby and required Gems. But looking for
> a capable database into which I can store the data,which I will fetch
> from the script.
>
> Thus asking if Ruby has any inbuilt one or suggest me if any open-source
> DB,which is capable with Ruby?
>
> Thanks
>

Ruby comes with several database-like libraries in the standard lib:
dbm, gdbm, YAML::DBM, pstore

Outside of Ruby, sqlite is probably the easiest to get started with if
you are already familiar with SQL.

-Justin
Posted by Michael Strauss-Cassel (Guest)
on 2013-01-30 21:12
(Received via mailing list)
what good is your help hasan if you are going to complain about it

rails comes with sqllite < it is official, but you can set easily any
dataengine you like

sql lite is the gig

On Wed, Jan 30, 2013 at 2:24 PM, Hassan Schroeder <
Posted by Love U Ruby (my-ruby)
on 2013-01-30 21:16
Michael Strauss-Cassel wrote in post #1094434:
> what good is your help hasan if you are going to complain about it
>
> rails comes with sqllite < it is official, but you can set easily any
> dataengine you like
>
> sql lite is the gig
>
> On Wed, Jan 30, 2013 at 2:24 PM, Hassan Schroeder <


Didn't get your point @Strauss
Posted by Tony Arcieri (Guest)
on 2013-01-30 21:20
(Received via mailing list)
On Wed, Jan 30, 2013 at 12:07 PM, Justin Collins 
<justincollins@ucla.edu>wrote:

> Ruby comes with several database-like libraries in the standard lib: dbm,
> gdbm, YAML::DBM, pstore
>

Hey look at that, finally someone with the right answer.

See also: SDBM

However which of these are available will depend on your Ruby
implementation, unfortunately
Posted by Brandon Weaver (Guest)
on 2013-01-30 21:21
(Received via mailing list)
Though if you don't know raw SQL you're in for some troubles. Study sql 
and
play with it for a while before you try making anything expansive. One
hours planning is worth 10 hours of frustrated coding.
Posted by Love U Ruby (my-ruby)
on 2013-01-30 21:26
Brandon Weaver wrote in post #1094437:
> Though if you don't know raw SQL you're in for some troubles. Study sql
> and
> play with it for a while before you try making anything expansive. One
> hours planning is worth 10 hours of frustrated coding.

@Brandon - I am 3 years of experienced with Oracle Sql,PL-sql. So Sql is 
not a big deal for me. The worried point is, which database should I 
choose. :)
Posted by Love U Ruby (my-ruby)
on 2013-01-30 21:27
Tony Arcieri wrote in post #1094436:
> On Wed, Jan 30, 2013 at 12:07 PM, Justin Collins
> <justincollins@ucla.edu>wrote:
>
>> Ruby comes with several database-like libraries in the standard lib: dbm,
>> gdbm, YAML::DBM, pstore
>>
>
> Hey look at that, finally someone with the right answer.
>
> See also: SDBM
>
> However which of these are available will depend on your Ruby
> implementation, unfortunately

Yes,bug Ruby : SDBM documentation is not good. Only list of method 
mentioned,but not a single example with them.
Posted by Reid Thompson (Guest)
on 2013-01-30 21:35
(Received via mailing list)
On Thu, 2013-01-31 at 03:21 +0900, Arup Rakshit wrote:
> I will do webpage scraping using Ruby and required Gems. But looking for
> a capable database into which I can store the data,which I will fetch
> from the script.
>
> Thus asking if Ruby has any inbuilt one or suggest me if any open-source
> DB,which is capable with Ruby?
>
> Thanks
>

PostgreSQL or Sqlite would be what I'd recommend.
sqlite would be the easiest to get up and running with.
Posted by Brandon Weaver (Guest)
on 2013-01-30 21:38
(Received via mailing list)
Making sure. You can never tell some times.

Sqlite is good for quick databases, MySQL for midrange, and postgre 
seems
to be getting a lot of credit for large but I haven't personally used 
it.
Posted by Justin Collins (Guest)
on 2013-01-30 23:45
(Received via mailing list)
On 01/30/2013 12:27 PM, Arup Rakshit wrote:
>> See also: SDBM
>>
>> However which of these are available will depend on your Ruby
>> implementation, unfortunately
>
> Yes,bug Ruby : SDBM documentation is not good. Only list of method
> mentioned,but not a single example with them.
>

Geez, how could I forget SDBM???

https://github.com/ruby/ruby/commit/66796b4c7efefc...

So actually there is documentation, but it's not showing up on
ruby-docs.org or rdoc.info.

-Justin
Posted by tamouse mailing lists (Guest)
on 2013-02-01 03:38
(Received via mailing list)
I think the best course for a new project is to start simple, go with
sqlite, if you find you need more performance or some particular
feature, bump up to postgresql. mysql is pretty common, but there are
concerns about its future under oracle. That said, there's no shortage
of opinions everywhere.

The Sequel gem is probably a good place to start, since it sounds like
you're well of in SQL programming:
https://github.com/jeremyevans/sequel/#readme

Even with that, it can take a bit to understand the Ruby that goes
around it, so I'd suggest experimenting a bit, do some prototypes to
figure out what you need, throw them away and then design, write your
tests, then write your app code.
Posted by Love U Ruby (my-ruby)
on 2013-02-01 04:30
tamouse mailing lists wrote in post #1094655:
> I think the best course for a new project is to start simple, go with
> sqlite, if you find you need more performance or some particular
> feature, bump up to postgresql. mysql is pretty common, but there are
> concerns about its future under oracle. That said, there's no shortage


My concern is - Does "Sqllite3" capable of storing 30000 rows in each 
table? I will use it in my internal projects.


Thanks
Posted by Carlo E. Prelz (Guest)
on 2013-02-01 07:18
(Received via mailing list)
Subject: Re: Does Ruby has any default database with it?
  Date: Fri 01 Feb 13 12:30:50PM +0900

Quoting Arup Rakshit (lists@ruby-forum.com):

> My concern is - Does "Sqllite3" capable of storing 30000 rows in each
> table? I will use it in my internal projects.

If you want to adopt a database engine, you'd better read some of the
documentation that comes with it. For example, look at the last item
in this page:

http://www.sqlite.org/limits.html

(I will add that a database engine that cannot not handle 30000
records would have very limited applications)

Carlo
Posted by Love U Ruby (my-ruby)
on 2013-02-01 07:50
Carlo E. Prelz wrote in post #1094684:
> Subject: Re: Does Ruby has any default database with it?
>   Date: Fri 01 Feb 13 12:30:50PM +0900
>
> Quoting Arup Rakshit (lists@ruby-forum.com):
>
>> My concern is - Does "Sqllite3" capable of storing 30000 rows in each
>> table? I will use it in my internal projects.
>
> If you want to adopt a database engine, you'd better read some of the

@Carlo :


Thank you very much! That's the information I was looking from you like 
experienced people.
Posted by Robert Klemme (robert_k78)
on 2013-02-01 08:51
(Received via mailing list)
On Fri, Feb 1, 2013 at 7:50 AM, Arup Rakshit <lists@ruby-forum.com> 
wrote:
>
> @Carlo :
>
>
> Thank you very much! That's the information I was looking from you like
> experienced people.

If it's just 30,000 items then Marshal or PStore might do as well.  If
the whole data set easily fits into memory that would probably be the
easiest choice.  Sample:

$ time ruby -e 'h={};30_000.times {|i|
h[i]=10.times.map(&:to_s)};t=Time.now;File.open("x","wb"){|io|Marshal.dump(h,
io)};puts(Time.now-t)'
0.3430196

real    0m0.597s
user    0m0.452s
sys     0m0.124s

Kind regards

robert
Posted by Tony Arcieri (Guest)
on 2013-02-01 09:51
(Received via mailing list)
On Thu, Jan 31, 2013 at 11:50 PM, Robert Klemme
<shortcutter@googlemail.com>wrote:

> If it's just 30,000 items then Marshal or PStore might do as well
>

Note PStore really sucks because it rewrites the entire database every
single time you mutate it. It's about the most brain dead persistence 
model
ever.
Posted by Robert Klemme (robert_k78)
on 2013-02-01 11:20
(Received via mailing list)
On Fri, Feb 1, 2013 at 9:50 AM, Tony Arcieri <tony.arcieri@gmail.com> 
wrote:
> On Thu, Jan 31, 2013 at 11:50 PM, Robert Klemme <shortcutter@googlemail.com>
> wrote:
>>
>> If it's just 30,000 items then Marshal or PStore might do as well
>
> Note PStore really sucks because it rewrites the entire database every
> single time you mutate it. It's about the most brain dead persistence model
> ever.

It's a tool.  There are use cases where it's appropriate and others
where it's not.  That has nothing to do with "brain dead".  The
approach to serialize objects is actually quite common in various
programming languages.

Cheers

robert
Posted by tamouse mailing lists (Guest)
on 2013-02-02 05:37
(Received via mailing list)
On Thu, Jan 31, 2013 at 9:30 PM, Arup Rakshit <lists@ruby-forum.com> 
wrote:
> tamouse mailing lists wrote in post #1094655:
>> I think the best course for a new project is to start simple, go with
>> sqlite, if you find you need more performance or some particular
>> feature, bump up to postgresql. mysql is pretty common, but there are
>> concerns about its future under oracle. That said, there's no shortage
>
>
> My concern is - Does "Sqllite3" capable of storing 30000 rows in each
> table? I will use it in my internal projects.

It might depend on how many tables, how many fields in each table, and
how much information is in each field, being used in a single
application. That said, sqlite is quite capable. Where sqlite tends to
fall down is when you have very complex relationships between tables
with many inserts/updates; and THAT said, that's where most databases
start to degrade in performance anyway, unless you're really good at
designing them AND understand how to do the SQL.
Posted by Reid Thompson (Guest)
on 2013-02-04 17:16
(Received via mailing list)
On Fri, 2013-02-01 at 12:30 +0900, Arup Rakshit wrote:
>
> My concern is - Does "Sqllite3" capable of storing 30000 rows in each
> table? I will use it in my internal projects.

easily.
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.