Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member

Importing and manipulating data

From: Drupal 6: Online Presentation of Data

Video: Importing and manipulating data

Technically speaking Drupal is a front-end display system for a back-end database. Throughout this course, we are going to be looking at the data as it resides in a MySQL database, which is the most common one to use with Drupal. You can manipulate that database in many ways such as, for example, through a command line interface or a platform specific SQL program, but we are going to use the web-base phpMyAdmin program that's included with both WAMP for Windows and MAMP for Mac and you have probably installed it to get Drupal running on your computer. I should mention that the database doesn't have to be MySQL. It could be PostgreSQL or Microsoft IIS and when Drupal 7 appears in late 2009 or early 2010, those database options will expand enormously.

Importing and manipulating data

Technically speaking Drupal is a front-end display system for a back-end database. Throughout this course, we are going to be looking at the data as it resides in a MySQL database, which is the most common one to use with Drupal. You can manipulate that database in many ways such as, for example, through a command line interface or a platform specific SQL program, but we are going to use the web-base phpMyAdmin program that's included with both WAMP for Windows and MAMP for Mac and you have probably installed it to get Drupal running on your computer. I should mention that the database doesn't have to be MySQL. It could be PostgreSQL or Microsoft IIS and when Drupal 7 appears in late 2009 or early 2010, those database options will expand enormously.

But for now, we are going to look once again at MySQL using phpMyAdmin. We are assuming that you already have Drupal up in running. All you need is the basic Drupal installation. You can learn how to install Drupal in the series Drupal Essential Training also from lynda.com. I also want to mention that whenever you use the exercise files or with this course on a disc the username is admin, a-d-m-i-n and the password is booth, b-o-o-t-h. Let's not talk about the database specifically but rather how to get data into it. There are basically four ways. The first way is through Drupal itself. This is the method that you undoubtedly already know and I'll show you how to do it now. Here we have our basic Drupal installation we have just created it.

To create content it's very simple. We go over to Create content. Click on the link. We are going to create a page, so we click on Page and fill in the form. I'm going to make this say "Hello, world!" "It's good to be here!" Scroll down to the bottom. I usually check my Publishing options and let's make this Promoted to the front page and say Save. Good. Now if we go back to our homepage, we see that there is our note that we have just created and if we click on it we could then go back and change it. Again, this is the simplest and most straightforward way of getting information into Drupal.

The problem with it is obviously you can only do one thing at a time. So we are also going to talk about some ways of bringing in a lot of information that you have in another system. One of those ways of bringing in more than one piece of information at once is by putting it directly in the database using phpMyAdmin or some other SQL program. This is something you should only do if you are absolutely sure that you know what you are doing and even then experience Drupal developers cringe when they see someone putting in data directly into the database because it bypasses Drupal's stability and security processes and the chances are very, very high that you will completely break your installation this way.

Don't worry! We'll show you a couple of better ways in a minute, but there are times when a quick and dirty SQL command is safe and convenient, so it's good to know that it's possible. To insert data using phpMyAdmin, you would first go to the program, click on your database in this case it's called "lynda" and find the table that you want to insert data into. Let's just pretend that we are going to insert something into role. We want to add a new kind of user role. Our browser just sees what's there and you see the two that are already built into Drupal, the anonymous user and the authenticated user.

If we wanted to add a role, we could do so using this Insert command or using the SQL command and then typing in the SQL command that was necessary to add or change a role there. Again this is very dangerous to do and I would only recommend changing information in the database if you really know what you are doing. So let's move on to a third method. You could also get information into Drupal using Drupal's API that's the Application Programming Interface. You would create a program usually in PHP that would talk to Drupal in the way that Drupal is used to. Now I have to admit, a few months ago I spent a week writing a big data import project using just SQL. I knew it was possible to do by writing a PHP program, but I'm not a programmer and I only know the smallest amount of PHP programming language. So I brought in all this data using SQL and I ran into all sorts of problems because as I say, bringing data and using SQL is not as easy as it sounds. There's a lot of dependencies within Drupal that only become clear if you bring the data in using one of the ways that Drupal understands and then it all works.

However, I was fortunate to find an article online written by somebody at the company Acquia and here it is, Migrating the Drupal way. It's a series and right now as I speak there's four parts of the series, but more maybe coming. But in the first part, if you scroll down a bit, it explains exactly how you can write such a program and gives you the code for a simple program to create a note. This is excellent if you already have a large database full of information that you need to bring into Drupal. Just find a way to export that data so that it fits into this program and bring it in one big PHP file. If you want to do more with Drupal's API, there are several resources that will help you.

The first one is this contributor's guide which you will find it contributors-guide on the Drupal.org website. It explains some of the procedures and thus practices for programming in Drupal and the links here will help you a great deal. Possibly the most important link there is to the Drupal API itself. The Drupal API is located at api.drupal.org. Here you will find a list of all of the commands that Drupal understands natively. These commands will let you program Drupal in way that it understands. As they say in the community, "It's the Drupal way." Finally, there are numerous modules to help you move and change data in a Drupal site. Two of the biggest and best known are called node import and user import. These modules are always in flux. If you want to use a module, look through the import and export section on drupal.org module directory to see if there is one that fits your needs. You can find that directory by going to drupal.org, clicking on Modules and then scroll down into this group of categories here, until you see Import/ export. Click there. Make sure you filter according to whichever version of Drupal you are using, in our case that's 6, and there you have it. Now you have a long list of modules that you could look through and decide which is best for you.

When you are learning Drupal, it's easy to forget how it's used in the real world, where you are often creating a site from data that came some outside source like business records or even another content management system. Your data presentation is only as good as the data itself. I hope this video helps you to move that data into Drupal, so you can start making it look great.

Show transcript

This video is part of

Image for Drupal 6: Online Presentation of Data
Drupal 6: Online Presentation of Data

50 video lessons · 11401 viewers

Tom Geller
Author

 
Expand all | Collapse all
  1. 12m 56s
    1. Welcome
      1m 12s
    2. Reviewing requirements
      3m 35s
    3. Using the exercise files
      3m 11s
    4. Touring examples of data visualization
      4m 58s
  2. 27m 56s
    1. Planning data structure
      8m 26s
    2. Importing and manipulating data
      6m 40s
    3. Looking at Drupal's database
      6m 13s
    4. Deciding whether to store personal data as nodes or users
      6m 37s
  3. 1h 13m
    1. Understanding the Content Construction Kit (CCK)
      4m 57s
    2. Creating new content types with CCK
      7m 26s
    3. Hiding the Body field
      2m 46s
    4. Reflecting CCK field data in the Title field
      7m 28s
    5. Managing CCK field placement
      7m 34s
    6. Exploring CCK's other features
      8m 22s
    7. Using other CCK field types
      3m 25s
    8. Adding date information as a CCK field
      8m 43s
    9. Including images as CCK fields
      10m 23s
    10. Connecting content to existing nodes
      5m 58s
    11. Using taxonomies to categorize and group data
      5m 59s
  4. 53m 54s
    1. Understanding why views are useful
      6m 12s
    2. Using SimpleViews to create basic content views
      5m 49s
    3. Diving into the Views interface
      11m 16s
    4. Adding fields to a view
      7m 12s
    5. Understanding iconic controls in the Views interface
      7m 15s
    6. Surveying the Sort, Filter, and Field options in Views
      5m 40s
    7. Adding view displays as pages, blocks, and RSS feeds
      10m 30s
  5. 43m 34s
    1. Overriding default settings on view displays
      8m 56s
    2. Attaching more information to views
      10m 57s
    3. Improving view appearances with grid, list, and table formatting
      9m 20s
    4. Surveying other basic display settings in Views
      11m 3s
    5. Altering a view's appearance through CSS
      3m 18s
  6. 55m 8s
    1. Importing, exporting, and cloning views
      6m 9s
    2. Controlling access to views
      7m 19s
    3. Learning from built-in views
      5m 52s
    4. Creating views that aren't based on nodes
      10m 6s
    5. Extending views with arguments
      10m 17s
    6. Extending views with relationships
      7m 2s
    7. Going further with relationships
      8m 23s
  7. 46m 40s
    1. Understanding geographic data
      4m 26s
    2. Setting up the Location module
      16m 20s
    3. Entering geographic data with the Location module
      10m 10s
    4. Displaying basic maps with the GMap module
      6m 43s
    5. Integrating the GMap module with Views
      9m 1s
  8. 54m 21s
    1. Exporting data in tabular form
      11m 25s
    2. Planning with the calendar modules
      11m 31s
    3. Using the Charts module and Google Charts
      7m 11s
    4. Graphing data with Open Flash Chart
      4m 50s
    5. Making important data pop out with tag clouds
      7m 46s
    6. Putting it all together in an attractive package
      11m 38s
  9. 36s
    1. Conclusion
      36s

Start learning today

Get unlimited access to all courses for just $25/month.

Become a member
Sometimes @lynda teaches me how to use a program and sometimes Lynda.com changes my life forever. @JosefShutter
@lynda lynda.com is an absolute life saver when it comes to learning todays software. Definitely recommend it! #higherlearning @Michael_Caraway
@lynda The best thing online! Your database of courses is great! To the mark and very helpful. Thanks! @ru22more
Got to create something yesterday I never thought I could do. #thanks @lynda @Ngventurella
I really do love @lynda as a learning platform. Never stop learning and developing, it’s probably our greatest gift as a species! @soundslikedavid
@lynda just subscribed to lynda.com all I can say its brilliant join now trust me @ButchSamurai
@lynda is an awesome resource. The membership is priceless if you take advantage of it. @diabetic_techie
One of the best decision I made this year. Buy a 1yr subscription to @lynda @cybercaptive
guys lynda.com (@lynda) is the best. So far I’ve learned Java, principles of OO programming, and now learning about MS project @lucasmitchell
Signed back up to @lynda dot com. I’ve missed it!! Proper geeking out right now! #timetolearn #geek @JayGodbold
Share a link to this course

What are exercise files?

Exercise files are the same files the author uses in the course. Save time by downloading the author's files instead of setting up your own files, and learn by following along with the instructor.

Can I take this course without the exercise files?

Yes! If you decide you would like the exercise files later, you can upgrade to a premium account any time.

Become a member Download sample files See plans and pricing

Please wait... please wait ...
Upgrade to get access to exercise files.

Exercise files video

How to use exercise files.

Learn by watching, listening, and doing, Exercise files are the same files the author uses in the course, so you can download them and follow along Premium memberships include access to all exercise files in the library.


Exercise files

Exercise files video

How to use exercise files.

For additional information on downloading and using exercise files, watch our instructional video or read the instructions in the FAQ .

This course includes free exercise files, so you can practice while you watch the course. To access all the exercise files in our library, become a Premium Member.

Join now Already a member? Log in

Are you sure you want to mark all the videos in this course as unwatched?

This will not affect your course history, your reports, or your certificates of completion for this course.


Mark all as unwatched Cancel

Congratulations

You have completed Drupal 6: Online Presentation of Data.

Return to your organization's learning portal to continue training, or close this page.


OK
Become a member to add this course to a playlist

Join today and get unlimited access to the entire library of video courses—and create as many playlists as you like.

Get started

Already a member ?

Become a member to like this course.

Join today and get unlimited access to the entire library of video courses.

Get started

Already a member?

Exercise files

Learn by watching, listening, and doing! Exercise files are the same files the author uses in the course, so you can download them and follow along. Exercise files are available with all Premium memberships. Learn more

Get started

Already a Premium member?

Exercise files video

How to use exercise files.

Ask a question

Thanks for contacting us.
You’ll hear from our Customer Service team within 24 hours.

Please enter the text shown below:

The classic layout automatically defaults to the latest Flash Player.

To choose a different player, hold the cursor over your name at the top right of any lynda.com page and choose Site preferences from the dropdown menu.

Continue to classic layout Stay on new layout
Exercise files

Access exercise files from a button right under the course name.

Mark videos as unwatched

Remove icons showing you already watched videos if you want to start over.

Control your viewing experience

Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.

Interactive transcripts

Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.

Learn more, save more. Upgrade today!

Get our Annual Premium Membership at our best savings yet.

Upgrade to our Annual Premium Membership today and get even more value from your lynda.com subscription:

“In a way, I feel like you are rooting for me. Like you are really invested in my experience, and want me to get as much out of these courses as possible this is the best place to start on your journey to learning new material.”— Nadine H.

Thanks for signing up.

We’ll send you a confirmation email shortly.


Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

   
submit Lightbox submit clicked
Terms and conditions of use

We've updated our terms and conditions (now called terms of service).Go
Review and accept our updated terms of service.