Back to top

HOWTO Use Drupal nodes to display information from other sources

I've been asked several times:

"I have data in a database and want to display it in Drupal and probably in a Drupal node. How do I do that?"

Well, here are some thoughts on that question. The answer may depend on the kind of data that you've got. Is it static or do you occasionally update it? Do you want users to be able to edit that data inside of Drupal and have the changes saved back to your database? Do you need Drupal to handle access control?

Just use a node

One solution is to simply use Drupal nodes. Write a script that takes your data and creates a new node - record for record - from your current data. If you have a few columns of data that are selections from a limited set you could convert those to taxonomies: e.g. you have a list of restaurant names with descriptions, a ranking (good/bad/fair) and a restaurant genre (Thai, Chinese, French, B-B-Q) then you could map the name into the title, the description into the body, the ranking into either a taxonomy category or as votes using the vote api, and the genre into a taxonomy category. This is ideally suited to relatively simple data.

Use Flexinode/CCK

Flexinode/CCK allow you to create somewhat more complex nodes where you create the necessary fields and Flexinode/CCK create the underlying database and HTML forms to be able to edit those fields. Then you create a few test nodes manually through the Drupal interface to see how fields get stored in the database and finally write a script to take your data and insert it into the database. It might make sense to make use of the fields-to-taxonomy system described above in addition to Flexinode/CCK.


QCodo is a code generation tool that can be used to create the "CRUD" (Create, Retrieve, Update, Delete). I know of someone working on a way to integrated Qcodo into Drupal. If you're interested in that idea, let me know.


If it is updated occasionally, you could keep a reference table from your data to the node ID value and create a script that not only creates the nodes but also can update them as necessary.

People Involved: 

Drupal 4.7 Released

Drupal 4.7 has been released. Here's the announcement on, and here's the story on Digg.

Very exciting stuff. It's more of an evolutionary released than a revolutionary one in my opinion, but there's enough evolution that it's headed towards lots and lots of fun. I've been implementing sites based on the nightly cvs and betas and release candidates for a while. Now I'll have to start upgrading sites.

People Involved: 

Colorado Wind Power

Ecology by Choice

I'm a big "choice" person. I want people to have the choice to do a lot of different things. I don't like monopolies, or overly restrictive regulation and I think those are fairly commonly held beliefs.

A few years ago I bought a house and started to pay more attention to the bills from our utility company, Xcel energy. One thing in the newsletter they send out got me curious: wind power for your homes. Xcel offers a program where you can buy wind electricity credits to cover your home usage. The details of the program aren't important aside from the fact that I pay a few extra dollars each month (and it really is just a few) so that my house and everything inside it "runs on wind power".

I like this solution because it lets Xcel know that I prefer a renewable energy source to a non-renewable one. Wind has its own problems, but I think they are outweighed by its benefits. This is great and I tell everyone I can to sign up for the program. It's amazing to me how many "environmentalist" friends that I know do not use this service.

Ecology by Force

A year and a half ago Colorado voted to force Xcel to make more of its energy from renewable sources with a specific amount from wind and a specific amount from solar. I'm opposed to this kind of regulation because our prescriptions for the amounts of wind/solar in the mix may not be the best decision 5 years from now, but we're basically stuck with them. I would much prefer that Xcel and residents work together in the way demonstrated by the wind credit program and through net-metering of home solar panels to help bring renewable energy into the mix based upon market demand. My belief was that if the people who voted for that renewable energy signed up for some wind credits then Xcel would see that the renewable energy sources stand on their own and that Xcel should provide more of them.

At the time of the legislation, there was excess capacity in the wind farm even though it's only 2% of the state electricity generation. How can a program that provides only 2% be under-subscribed when a ballot measure gets a popular vote by approximately 20% of the state? Basically it's because people are hypocrites or lazy or both. note: I got to 20% based upon ~60% of people in favor and ~30% voter turnout.

People Involved: 

Advice for small ISVs and Scumbucket Investment Bankers

I stumbled upon this article yesterday and it's a good read. Basically, Eric Sink, who founded a small ISV (Independent Software Vendor) writes about life as a small ISV and why you should make lots of mistakes, just not any fatal mistakes. ISV's are small to medium businesses - maybe somewhere between 2 and 200 people and they create applications to sell to other people.

People Involved: 


Subscribe to RSS