Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By jenkins-1 on
I have a database here for real estate listings. I'm trying to create a node for each listing, and for groups of listings organized by city, number of bedrooms, bathrooms, price, etc. The problem I see is that there are thousands of listings in the database - so I need some sort of automated system to create all of these nodes...
Can anyone recommend a good solution for this? I need basic site structure advise here.
Thanks!
Comments
Some thoughts
I have been working on somthing similar (import 32,000 telephone messages) but, if you are looking for an automated system, you might be out of luck.
#1
Take a look at...
http://drupal.org/node/14858 (Mass Import Module)
#2
A word of caution, the drupal database structure isn't as simple as 1 record in a table equals a complete node. Grouping nodes(in your case real estate listings) means relating a listing to several categories like city, bathrooms. That means inserting a record, getting the resulting node id# then trooping over to term_data table and adding the appropriate node<->term records.
#3
Another approach would be to create a "Real Estate Module" that matches how you want the data stored. You would still have to shoe horn the data into drupal but you would have greater control over how that data is stored. For example instead of city, bedrooms being categories, they would just be extra fields to be filled out on the form that are stored in your "real_estate" table. You would probably also want custom search, report options as well. Leaving the category system means you are leaving the built in tools for slicing and dicing drupals taxonomy system.
If you are comfortable with a database, then I would suggest figuring out drupals way of storing nodes and creating INSERT commands inside excel then following option #2.
Not pretty and takes a few hours but I am open to suggestions...
You'll need to use the drupal way
To do something like this, I eventually got all my data into a temporary table, then wrote a small import function that would insert nodes and menu items appropriately using a few of the Drupal routives - node_save() and stuff.
Internally, there was an issue with the way drupal doesn't actually autoincrement , it keeps its own table, and using the proper interface rather than my own DB inserts protected me from strangeness I don't even know about.
A dozen lines or so should be able to read your data, then create, classify, update and menu each row as a drupal node. ... on a one-off sort of way.
.dan.
.dan. is the New Zealand Drupal Developer working on Government Web Standards