2

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

My Question: 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.

1
  • I’m voting to close this question because it's asking for recommendations or suggestions on books, tools, modules, themes, distributions, tutorials, or other off-site resources.
    – apaderno
    Mar 19, 2021 at 8:57

2 Answers 2

2

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());
0

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.

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