I've been asked to build a small database administration site based on Drupal. The site should have basic editing possibilities of the existing database with several tables. (The structure is not complicated).

To get it more clear, one table contains books being sold in the publishing center. The book has a set of identification numbers, title, e.g. The structure of book is very similar to basic node with fields.

The question is: Is it a good idea creating a custom entity with described architecture and process data in terms of 'book' entity (and therefore the database will be automatically modified according to current architecture) OR it's better to implement simply some interface and update database manually using db_query etc. ?

  • The structure of book is very similar to basic node with fields....in that case: no, don't use a new entity type, and don't use a custom table. Use a content type :) Your use case is perfect for the in-built node system, is there some reason you can't/won't use it?
    – Clive
    Oct 2, 2012 at 15:16
  • Sorry if I haven't expressed clearly, the database already exists and I'm asked only to write a simple interface for editing this database in editor-friendly style (like phpMyAdmin but much simpler and much more narrowed). By "the structure is very similar..." I meant that the structure is flat, simple (not complicated, for example a tree or something). And actually my task cannot be solved with custom entity with fields because Drupal stores fields in very specific, Drupal-way:)
    – DimG
    Oct 2, 2012 at 19:08
  • So the question is about writing a custom entity with fields described in hook_schema (not Field API!) or, just write all editing forms from scratch and use Query API. Personally I don't like both variants because the task is specific and I don't see Drupal as a framework for creating database admin-panels=) But I was asked ti build it exaclty with Drupal and I wonder what way is the best.
    – DimG
    Oct 2, 2012 at 19:11

1 Answer 1


While I can't see any significant benefits to doing this with Drupal, I think this should generally work. I've converted old systems that were using db_query and custom code to Drupal 7 Entities with the Entity API module with success, and I've been pretty pleased with the results. As long as the schema is solid, without issues, or you can modify it as needed, this will work fine.

Depending on the data structures and the normalization of related entities/properties you may need to create your own EntityController to override the loading (and saving if using Entity API module) to ensure that the data is queried and updated properly.

  • ECK might be worth a look as well
    – Clive
    Oct 2, 2012 at 23:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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