How hard is it to use an alternate database

Events happening in the community are now at Drupal community events on www.drupal.org.
hank777's picture

Hi Everybody,

I am totally new to the drupal world and so I am going to ask what I am sure is a total noob question.

I am developing a product that offers storage in the internet cloud via a rest API.

I would like to offer mod or a plugin that would allow drupal data to be pulled from a non-standard source, i.e. my database system. How easy/hard is this? Are there bottleneck routines in drupal that "get and set" the data so that these functions could be replaced or overridden and be using a different source?

Basically I just want to find out how hard it is to make drupal be able to get and store all the data it needs, but just to use an alternate (and we think better) data source?

Also, could someone point me towards any online documentation of the drupal data model? I am sure I could just grab the doc and pour over it and its there somewhere, but I really just want some kind of a schema description right now.

Thanks
Hank

Comments

welcome

ericg's picture

Hi hank,

Welcome to the drupal community.

I think what you are looking to do is possible. I've done some work integrating drupal to other systems, but without more details all I can say is I think what you want is possible. I do have some questions about the licensing of the system you are linking to and the method you would use to share data between drupal and the other system (this is of concern because drupal is licensed under the GPL and there are ways that you could link drupal and a non-gpl application that would violate the GPL.)

Don't take this as me being rude, but as offering some help in navigating the world of drupal, getting drupal assistance and participating in the general drupal community.

It would be best, and I'd be more than interested in continuing this discussion, if you post your question to the main drupal.org site, that's the spot where you're going to get the most help and where it is most appropriate.

Think of the primary drupal site as the place for discussion about drupal and drupal development in general, and the groups.drupal site as more a place for meta-discussions and planning amongst people with similar projects/goals/geographic location.

This group will be most useful to all of us if we keep the posts to things that are of direct interest not only to drupal folks but explicitly to drupal folks that are in NYC.

GPL and database connectivity...

lego1974's picture

Hey Eric,
is there really a GPL issue with creating SQL statements against a non-open source DB? I thought that the issues arose if you modified code and released it as your own. I was under the impression that even linking binaries was ok (e.g. the wifi drivers for various linux distros).

the issue as I understand it...

ericg's picture

There was a long thread on the Drupal Developer list a while back where this was discussed. After that I contacted the Free Software Foundation to first verify some of what was attributed to them in the discussion and to get some feedback on the methodology that we at Openflows use when linking Free Software tools with non-free tools.

Basically, in the opinion of the FSF:
A: if, from within one function, you can call or backtrace to the api of a GPL app and an app who's license is not compatible with the GPL, you have created a derivative work that is a violation of the GPL.
B: If you are making a command-line call or using http/https or other similar protocols to access the non-free system and then acting on the returned data in the free system, you are not in violation of the GPL.

If you want more detail, check out the archive of posts from the Drupal Developer mailing list.

RE: Welcome

hank777's picture

Thanks. I will post to the main site. But the reason I posted here is I am in NYC, and I was thinking (but didnt say) that I am kinda hoping to connect with people in NY. I missed the meeting yesterday but my intent is to come to the next one. I find local interaction much more appealing.

Regards,
Hank

now that's relevant! :)

ericg's picture

Great!

There are many things that frustrate me about drupal and drupal development, but the drupal community is so diverse and strong that it overshadows all that. All you have to do is look at the NYC Drupal Camps that have happened to see the power of community-centric knowledge, code and skills sharing.

I have not made it to the nyc meetups since they started being done in more corporate surroundings that require pre-registration for attendance. I'm never sure if I can attend until the last minute. hopefully I'll be able to schedule time for the next one.

Hi Eric

marketanomaly's picture

You can sign-up for the meetup even if you don't come. Unfortunately, we outgrew our MNN space. Let me know if you hear of a good public space with WIFI and seats for 30-40 people.

thanks

ericg's picture

I thought there was a limit on the number and did not want to deny someone else the ability to show up by signing up and not showing.

I'm sure the corporate spaces being used are great but maybe we can aim to do one out of every three meetups at a more community-centric/non-profit space?

I've asked a few places I know that might be able to host the event from time to time, I'll let you know what they say.

MNN Space...

lego1974's picture

Hey Market Anomaly, I just left MNN as the director if IT. The reason we couldn't have the meetups there was because MNN was doing renovations on the conference room. If you'd like to reschedule, let me know and I can hook you up. The new conference room is pretty nice. Plus, they just upgraded the public wifi, so it's decent now.

-Andy

Amazon S3

benjaminlhaas's picture

This is maybe sorta kinda related...not exactly sure if it's of interest to you, though. I recently updated a site to store/retrieve image and video on Amazon S3. It was a bit of a challenge to implement - it required tweaking every module that saves and retrieves media to disk or database. Ultimately the problem lies in the fact that Drupal doesn't have a clean, abstracted file system layer sitting between modules and low-level core functionality. There's a related thread here if you want to read more: http://groups.drupal.org/node/2383.

alternate DBs...

lego1974's picture

Hi Hank777,

you know, I was just looking into this issue myself. At my previous job we do some things where some modules go to a PGSQL db and the rest use MySQL. There's a good book that covers a little of this called "Pro Drupal Development". I'm on Ch 6 at the moment.

When I first approached Drupal, I had the same question. Let's say you wanted to backend Drupal with DB2 (Why you'd want to do that is beyond me, but it's an interesting example). From what I've seen, the Drupal API is pretty well abstracted such that calls you'd make in your code look like db_query(), with no overt reference to a DB implementation. So, core is pretty safe.

However, for each module, the creator has to provide an install file. This install file provides a way for the system to create/delete the tables the module needs upon installation/removal. What strikes me as odd (and please correct me if I'm wrong), is that the instructions for adding/dropping tables is db implementation dependent. So, you have to provide SQL statments for MySQL, PGSQL, and DB2, if your module is to support them. The problem arises that many contributed modules are developed solely on MySQL, and so you'd have to write your own install routines in the module's install files. This isn't so hard if there are a few modules involved, but once you start using lots of 3rd party modules, well, it seems like it'd get out of hand.

that's my understanding, and again, I could be way off.

-Andy

D6

jredding's picture

just an aside, D6's schema API helps to solve some of the DB abstraction stuff with contributed modules. Specifically the .install files are no longer DB specific (the whole switch statement stuff). Of course if you do DB specific function calls in your modules (example TOP() ) then it breaks the functionality. All(?) of the DB specific PHP functions have abstracted already
ex.
mysql_query or mysql_num_rows become db_query and db_num_rows.

its not perfect but its getting better.

-Jacob Redding

-Jacob Redding