[RAILS] Why not a DBIAdapter?

Hi all,

Well, since the rails mailing list idea was rejected, and since I
avoid IRC while at work, and I can never remember to recheck wiki
postings, I'm posting here. Yell at DHH if you don't like it. :stuck_out_tongue:

I'd love to give rails a try. Unfortunately, we use Oracle here at
work and there isn't yet an Oracle adapter. I started creating one
using OCI8, but the more I look, the more I'm confused as to why there
isn't a "generic" adapter using DBI.

Looking at the AbstractAdapter class, I see a series of methods that
look like they need to be defined. Is there one that can't be handled
via DBI? I don't see one. They look generic to me, both in terms of
executing sql as well as retrieving metadata. If there are any that
require driver specific functions, can't we just call the appropriate
'func' method on the handle based on the driver name?

Plus, couldn't you somehow then take advantage of DBI's extra
features, like XML/XSLT/XSQL stuff?

What am I missing?

Regards,

Dan

PS - No, I don't care about the extra overhead from using DBI over
vendor specific drivers.

Well, since the rails mailing list idea was rejected, and since I
avoid IRC while at work, and I can never remember to recheck wiki
postings, I'm posting here. Yell at DHH if you don't like it. :stuck_out_tongue:

To stay in touch with the wiki, I recommend looking into RSS. Nobody can stay on top of a wiki by hand (or at least, I wouldn't want to). RSS is proving a major benefit to the wikis of the world.

Plus, couldn't you somehow then take advantage of DBI's extra
features, like XML/XSLT/XSQL stuff?

What am I missing?

Rails actually started out using DBI, but to get the functionality I wanted, I had to redo a bunch of things on the Rails side that was already being done in DBI. And when I started doing some performance testing, this double work proved to have a overhead of about 100%. So at least for the MySQL adapter, I thought about how hard it would be to do my "own" adapter to MySQL-ruby.

It proved to be remarkably easy. I think the adapter is around 80 lines of code or something. Then Luke Holden did the SQLite and PostgreSQL adapters in a few hours and that was pretty much the end of DBI for Active Record. It was just too easy to do local adapters that didn't have any of the DBI overhead and could do things the way Rails needed them to be done.

Also, I think to keep my dependencies at a minimum. Active Record is pretty self-contained. It even includes the Ruby-based Ruby-MySQL adapter. So you only need to add the C-based bridges to get going with other databases.

But. With all that said. It's not that I think DBI is a bad project or that I would mind having a DBI adapter. DBI is great and if anyone would rather do a DBI adapter than a set of local ones, I'd be happy to accept it into Rails.

I am, however, concerned that doing a generic DBI adapter might conflict with the auto-incrementation required by AR. There was talks about how it was pretty hard even for ODBC.

Do my preference is for local adapters, but I would be willing to accept a DBI adapter while those local ones were being made.

ยทยทยท

--
David Heinemeier Hansson,
http://www.rubyonrails.org/ -- Web-application framework for Ruby
http://www.instiki.org/ -- A No-Step-Three Wiki in Ruby
http://www.basecamphq.com/ -- Web-based Project Management
http://www.loudthinking.com/ -- Broadcasting Brain
http://www.nextangle.com/ -- Development & Consulting Services

I'd love to give rails a try. Unfortunately, we use Oracle here at
work and there isn't yet an Oracle adapter. I started creating one
using OCI8, but the more I look, the more I'm confused as to why there
isn't a "generic" adapter using DBI.

I've asked on Rails FAQ why new adapters and not DBI. But no answer yet. I know one reason right off the bat. The #insert method returns the id key of the newly inserted record. DBI dosen't have a standard mechinism for this. I asked about it on DBI mailing list. There is disagreement on how to do, b/c keys can be more complex. I.e they can be multi-field keys and also auto-incremental or not. Plus lack of standard between backends. Active Record assumes you always have a field called id that is auto-incremental.

Two days ago I stripped ActiveRecord's adpater code out, improved upon it, and made it a separate library called ActiveDBA. I like it b/c its more straght foward than DBI (and also b/c of the key return on insert.) It could still use some improvement but it works well (I've been using it for another project) I wrote David to see if he was interested in its release. But he hasn't wrote back yet. Anyone else interested in such a thing? --essentially an alternative to DBI.

Looking at the AbstractAdapter class, I see a series of methods that
look like they need to be defined. Is there one that can't be handled
via DBI? I don't see one. They look generic to me, both in terms of
executing sql as well as retrieving metadata. If there are any that
require driver specific functions, can't we just call the appropriate
'func' method on the handle based on the driver name?

Indeed, I could write a ActiveDBA adapter for DBI in about a day + time to figure out how to deal with the id key across different DBDs. I need more input from DBI developers to work that out. Are you interested in such a thing?

Plus, couldn't you somehow then take advantage of DBI's extra
features, like XML/XSLT/XSQL stuff?

For?

T.

Plus, couldn't you somehow then take advantage of DBI's extra
features, like XML/XSLT/XSQL stuff?

What am I missing?

And of course, you can use your own "model" instead of ActiveRecord, if you wish.

David Heinemeier Hansson said:

Well, since the rails mailing list idea was rejected, and since I
avoid IRC while at work, and I can never remember to recheck wiki
postings, I'm posting here. Yell at DHH if you don't like it. :stuck_out_tongue:

To stay in touch with the wiki, I recommend looking into RSS. Nobody
can stay on top of a wiki by hand (or at least, I wouldn't want to).
RSS is proving a major benefit to the wikis of the world.

Agreed! I just added the Rails/ActiveRecord/ActionPack wikis to my
aggregator, but noticed that the article links were incorrect.

Link provided by RSS: Ruby on Rails โ€” A web-app framework that includes everything needed to create database-backed web applications according to the Model-View-Controller (MVC) pattern.

Link that worked: Ruby on Rails โ€” A web-app framework that includes everything needed to create database-backed web applications according to the Model-View-Controller (MVC) pattern.

ยทยทยท

--
-- Jim Weirich jim@weirichhouse.org http://onestepback.org
-----------------------------------------------------------------
"Beware of bugs in the above code; I have only proved it correct,
not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas)

"David Heinemeier Hansson" <david@loudthinking.com>

I am, however, concerned that doing a generic DBI adapter might
conflict with the auto-incrementation required by AR. There was talks
about how it was pretty hard even for ODBC.

                              ^^^^^^^^^^^^^^^^^^^^^
Very true for ODBC as a generic solution. It is not that hard once we
choose to limit ourselves to Database specific solutions. I know, I know
that defeats the whole purpose ... but if you want to do it just to get
an idea of how powerful the framework is, I say don't worry too much
for the genericity.

Dan: is it possible to connect to your Oracle datasource using ODBC?
If it is, I would love to have you try out my ODBC adapter for AR. I
have already tried it on MS-Access and SQL Server 2000 and it works !

-- shanko

David Heinemeier Hansson said:

To stay in touch with the wiki, I recommend looking into RSS. Nobody
can stay on top of a wiki by hand (or at least, I wouldn't want to).
RSS is proving a major benefit to the wikis of the world.

Since you mentioned it: I've tried a few RSS aggregators and found that they seem to get in my way... I can't seem to find a way of using them that doesn't feel clunky. I'm willing to admit that my own inexperience with them is getting in my way, though, so here's the question:

Those of you that are "successfully" using RSS aggregators, which aggregator(s) do you use, and how do you use it? (I don't need instructions, I just want to know how you employ it, day-to-day).

Thanks!

- Jamis

ยทยทยท

--
Jamis Buck
jgb3@email.byu.edu
http://www.jamisbuck.org/jamis

"I use octal until I get to 8, and then I switch to decimal."

Jamis Buck <jgb3@email.byu.edu> writes:

Those of you that are "successfully" using RSS aggregators,
which aggregator(s) do you use, and how do you use it? (I don't
need instructions, I just want to know how you employ it,
day-to-day).

I read a bunch of RSS feeds inside Gnus. What's nice about that,
is it makes the feed appear like a newsgroup or an imap mailbox.
It's really no different, in terms of user-interface.

Since you mentioned it: I've tried a few RSS aggregators and found that they seem to get in my way... I can't seem to find a way of using them that doesn't feel clunky. I'm willing to admit that my own inexperience with them is getting in my way, though, so here's the question:

Those of you that are "successfully" using RSS aggregators, which aggregator(s) do you use, and how do you use it? (I don't need instructions, I just want to know how you employ it, day-to-day).

I felt the same way for a long time. Until I got NetNewsWire on the Mac. That was the first RSS reader that really felt right.

I don't know what the state of affairs are on Linux, though. There's a bunch of readers on Windows, though.

ยทยทยท

--
David Heinemeier Hansson,
http://www.rubyonrails.org/ -- Web-application framework for Ruby
http://www.instiki.org/ -- A No-Step-Three Wiki in Ruby
http://www.basecamphq.com/ -- Web-based Project Management
http://www.loudthinking.com/ -- Broadcasting Brain
http://www.nextangle.com/ -- Development & Consulting Services

David Heinemeier Hansson said:
>To stay in touch with the wiki, I recommend looking into RSS. Nobody
>can stay on top of a wiki by hand (or at least, I wouldn't want to).
>RSS is proving a major benefit to the wikis of the world.

[snip]

Those of you that are "successfully" using RSS aggregators, which
aggregator(s) do you use, and how do you use it? (I don't need
instructions, I just want to know how you employ it, day-to-day).

I've tried a number of aggregators (nttp/rss, raggle, amphetadesk,
centericq) but finally decided to handle RSS feeds as plain emails. I
tried fetchrss (java based) but didn't really like it. Finally I
stumbled upon rss2email[1]. I've set it up as a cron-job, and it works
perfect. The only "downside" is that it's a python hack <smile>.

On debian simply do 'apt-get install rss2email' and you're set.

    [1]: http://www.aaronsw.com/2002/rss2email/

//Anders

ยทยทยท

On Thu, Aug 19, 2004 at 02:29:04AM +0900, Jamis Buck wrote:

--
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. Anders Engstrรถm aengstrom@gnejs.net
. http://www.gnejs.net PGP-Key: ED010E7F
. [Your mind is like an umbrella. It doesn't work unless you open it.]

On Windows I really like Feedreader--very lightweight and fast.
On Mac I like NetNewsWire but the lite version was a bit lacking in
features. One that looks okay that I haven't used too much is
NewsMac.
On Linux Straw looks pretty good, but I haven't tried it yet.

Carl

ยทยทยท

On Thu, 19 Aug 2004 02:29:04 +0900, Jamis Buck <jgb3@email.byu.edu> wrote:

David Heinemeier Hansson said:
>To stay in touch with the wiki, I recommend looking into RSS. Nobody
>can stay on top of a wiki by hand (or at least, I wouldn't want to).
>RSS is proving a major benefit to the wikis of the world.

Since you mentioned it: I've tried a few RSS aggregators and found that
they seem to get in my way... I can't seem to find a way of using them
that doesn't feel clunky. I'm willing to admit that my own inexperience
with them is getting in my way, though, so here's the question:

Those of you that are "successfully" using RSS aggregators, which
aggregator(s) do you use, and how do you use it? (I don't need
instructions, I just want to know how you employ it, day-to-day).

Thanks!

- Jamis

--
Jamis Buck
jgb3@email.byu.edu
http://www.jamisbuck.org/jamis

"I use octal until I get to 8, and then I switch to decimal."

Jamis Buck wrote:

Those of you that are "successfully" using RSS aggregators, which aggregator(s) do you use, and how do you use it? (I don't need instructions, I just want to know how you employ it, day-to-day).

Like Josh and Anders mentioned, I think an e-mail-ish paradigm works great for RSS. I've been using the bleeding edge Moz Thunderbird, which lets you add an RSS account. It's excellent: notifies me when feeds are updated, allows me to view either the RSS <description> summary or the permalink URL in my preview pane.

_why

* Jamis Buck <jgb3@email.byu.edu> [0829 18:29]:

Since you mentioned it: I've tried a few RSS aggregators and found that
they seem to get in my way... I can't seem to find a way of using them
that doesn't feel clunky. I'm willing to admit that my own inexperience
with them is getting in my way, though, so here's the question:

Raggle (www.raggle.org) runs curses, drb or webrick interfaces to your
feeds, and is a pure ruby implemenentation - I found it as featureful as
netnewswire/straw/liferea et al (which are all basically the same interface)
but more versatile - little things like the curses interface is screen(1)
aware, so will pop up elinks/w3m/whatever in a new window. It also supports
opml or yaml feedlists, I managed to import my liferea feeds into it fine.

It's got a couple of rough edges, but the code is fairly legible, I'd certainly
recommend it.

ยทยทยท

--
Rasputin :: Jack of All Trades - Master of Nuns

Firefox + Sage.

RSS feeds are saved as bookmarks, Sage is a sidebar panel that checks
for updates and marks the bookmark with a red star. Clicking on the
bookmark gives you an HTML page generated from the RSS feed. You can
open permalinks in new tabs/windows as you like, or just read and
dismiss an entry if it supplies a decent summary.

http://sage.mozdev.org/

(It is even localized for jp-JP!)

ยทยทยท

Jamis Buck (jgb3@email.byu.edu) wrote:

Those of you that are "successfully" using RSS aggregators, which
aggregator(s) do you use, and how do you use it? (I don't need
instructions, I just want to know how you employ it, day-to-day).

--
Eric Hodel - drbrain@segment7.net - http://segment7.net
All messages signed with fingerprint:
FEC2 57F1 D465 EB15 5D6E 7C11 332A 551C 796C 9F04

Sorry I didn't answer your other question. With Feedreader, I just
leave it checking my feeds all day long. It spins a tray icon when
there is more news waiting. I usually read all the new headlines from
my feeds for 1/2 hour or so in the morning when I get to work and then
I glance briefly at any new ones that pop up during the day.

ยทยทยท

On Wed, 18 Aug 2004 12:22:21 -0700, Carl Youngblood <carl.youngblood@gmail.com> wrote:

On Windows I really like Feedreader--very lightweight and fast.
On Mac I like NetNewsWire but the lite version was a bit lacking in
features. One that looks okay that I haven't used too much is
NewsMac.
On Linux Straw looks pretty good, but I haven't tried it yet.

Carl

On Thu, 19 Aug 2004 02:29:04 +0900, Jamis Buck <jgb3@email.byu.edu> wrote:
> David Heinemeier Hansson said:
> >To stay in touch with the wiki, I recommend looking into RSS. Nobody
> >can stay on top of a wiki by hand (or at least, I wouldn't want to).
> >RSS is proving a major benefit to the wikis of the world.
>
> Since you mentioned it: I've tried a few RSS aggregators and found that
> they seem to get in my way... I can't seem to find a way of using them
> that doesn't feel clunky. I'm willing to admit that my own inexperience
> with them is getting in my way, though, so here's the question:
>
> Those of you that are "successfully" using RSS aggregators, which
> aggregator(s) do you use, and how do you use it? (I don't need
> instructions, I just want to know how you employ it, day-to-day).
>
> Thanks!
>
> - Jamis
>
> --
> Jamis Buck
> jgb3@email.byu.edu
> http://www.jamisbuck.org/jamis
>
> "I use octal until I get to 8, and then I switch to decimal."
>
>

why the lucky stiff wrote:

Jamis Buck wrote:

Those of you that are "successfully" using RSS aggregators, which aggregator(s) do you use, and how do you use it? (I don't need instructions, I just want to know how you employ it, day-to-day).

Like Josh and Anders mentioned, I think an e-mail-ish paradigm works great for RSS. I've been using the bleeding edge Moz Thunderbird, which lets you add an RSS account. It's excellent: notifies me when feeds are updated, allows me to view either the RSS <description> summary or the permalink URL in my preview pane.

_why

Wow, that's what I need, right there. That sounds like a perfect fit. I already use Thunderbird... I guess the question now is: do I try to install the bleeding edge, or do I wait until the next release?

Decisions, decisions...

Thanks all, for your feedback!

ยทยทยท

--
Jamis Buck
jgb3@email.byu.edu
http://www.jamisbuck.org/jamis

"I use octal until I get to 8, and then I switch to decimal."