Take the 2-minute tour ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

I am setting up some reports using DB API to query custom content fields, and rendering in tables and charts. I am looking for a way to easily look up the names of tables and fields in the Drupal DB.

Is there a Devel-type module that provides an easy reference of the live DB schema?

Currently I'm using drush sql-cli and/or phpmyadmin, so the solution should be something simpler than that. Thanks

share|improve this question
add comment

2 Answers

up vote 2 down vote accepted

I think the Schema Module can handle that...

  • Schema documentation: hyperlinked display of the schema's embedded documentation explaining what each table and field is for.

I confess I haven't tried it but the module page mentions

the INFORMATION_SCHEMA database that the Schema module uses to inspect the database.

so I imagine it has the functionality you're looking for, plus inspection of the live db if you need it.

Or if you don't mind wading through a large krumo array you can always use drupal_get_schema()

dpm(drupal_get_schema());
share|improve this answer
add comment

You can list db tables with

  • mysql: show tables;
  • psql: \d

However, a better way to get field information would be via a Drupal module and use:

To get the detailed field and instance information.

Table information for each field is also stored in the info structure.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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