1

I'm new to Drupal 7. Right now I'm trying to use D7 to build an interface that allows me to directly manipulate the tables in the database. I have installed a couple modules such as Data, Migrate, Feeds, and etc. I managed to create a view to display the table that I created using Data Module, but I need to add and update the rows from the interface. Furthermore, is it possible to set up relational tables so that I can update or delete related rows at the same time using Drupal?

Thanks in advance

Yea, I just started learning Drupal, even new to the whole CMS thing. I decided to take the chance to learn Drupal for my project. But thanks all for the help I really appreciate the helps. I will come back and vote up the answers when I have enough rep.

3 Answers 3

4

Drupal isn't an MVC framework.

Content types and entities give you a way to insert records into a database, and edit them as well.

Making a "view" of one kind of record is possible with the Views module, and also the VBO module.

Deleting "related things" is trickier and requires the use of built-in hooks to remove related items from the database typically. Or if using Entities you could wire removing relationships into the Entity Controller.

Simply put, Drupal isn't a Ruby on Rails-like framework where you get CRUD capability for free; it currently acts more like the Linux kernel (in my opinion) where you register or "hook-into" the lifecycle of a thing and alter it to your needs.

You may find these 2 modules useful:

  • Model Entities uses Entities to kind of create a CRUD like interfaces for custom objects built with D7 Entity(s).
  • SBDO an ORM for custom object tables in drupal
3
  • Thanks alot, I appreciate it. So what would you recommend me to achieve my objective right now? Should I still use Drupal? I just started using it, and totally noob to RoR.
    – lusketeer
    Commented Jun 7, 2012 at 20:44
  • you can use drupal with content types, entities ... also the entity_reference module or the Relation module to do whatever you want ... my only point is that Drupal is more a CMS than a framework. You seem to be asking this question from an MVC point of view, "I have records and need to relate them" ... You need to evaluate Drupal and see if it can meet your needs in your timeframe.
    – tenken
    Commented Jun 7, 2012 at 23:06
  • @tenken +1 for the answer, but Drupal is definitely more of a framework than a CMS these days, it's just not based on MVC
    – Clive
    Commented Jun 8, 2012 at 10:56
2

The short answer is: yes, you can. I don't think you'll find a module that will provide a pointy clicky view of random tables and allow you to manipulate them. However, there are modules and frameworks that allow you to do just about anything you can imagine with your database. For example, OG provides a rich infrastructure for creating, modifying, deleting, and relating content.

For a more hands on approach, take a look at the Drupal 7 database abstraction layer documentation http://api.drupal.org/api/drupal/includes%21database%21database.inc/group/database/7

2

I found a way to get create, modify, and delete working just using feeds, views, and content type.

I create a content type and added fields for the table I wanted. And then I used feeds to import the csv file mapping to the content type I created. Use views to create a display to display the table, and then add extra field (Content: Edit Link) to provide a link to edit specific node.

Haven't figured out how to relate multiple tables yet, in this case, relating fields of different content type. But I got most of the work done.

Hope this can help someone else who happens to have the same goal.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.