1

The last days I got some trouble with the drupal database schema. I don't know anything about Drupal7 except that database entries are saved in several fields.

I need to read out all the different nodes and their attributes of a mysql server in Drupal Scheme (in the best case without actually using the Drupal environment) with a simple .php page. Is there any chance to do so?

Example: Car Entries - what I need are

field_data_field_speed

field_data_field_weight

and more.

Would be grateful for help!

UPDATE: Database Drupal relationship between tables, to get a node schema and node data.

  • Welcome to Drupal Answers :) What's your actual question here? It sounds like you're asking if you can export data from a MySQL database without Drupal getting involved, which of course you can do, no-one can stop you, but what you need to know about Drupal isn't clear. Are you hoping someone will write the queries for you? Give you an exhaustive outline of every table and field, and its relationships to other tables? If you could edit the question to clarify that would be great. Please do bear in mind if it's either of the latter, it's going to be much too broad for Q+A – Clive Oct 13 '15 at 14:52
  • If you could also confirm why you've tagged this with the "Views module" tag and "Entity Field Query" tags, that would be good. It's hard to imagine how either of those could be involved in what you're asking – Clive Oct 13 '15 at 14:54
0

If I'm not wrong you want a 'query' that connect a content type with all its fields.

Each field has it own table.

But you can connect the dots using a few queries ([content_type_name] could be article, car_entry or whatever the name of your content type is):

*Getting all the entries for a content type

SELECT * FROM node WHERE type = '[content_type_name]'

column id would be the [entity_id]

*Getting all fields from a content type

SELECT * FROM field_config_instance WHERE entity_type = 'node' AND bundle = '[content_type_name]'

this table contains column field_id [field_id] and column field_name [field_name]

Now that you have the fields:

*Get the field info using field_id and/or field_name

SELECT * FROM field_config WHERE id=[field_id] AND field_name='[field_name]'

*Get the field data by node

SELECT * FROM field_data_[field_name] WHERE entity_id = [entity_id]

Play around with those queries, so you get a better idea of the columns that each one of those tables contains. Then you can create mysql joins to create the queries that you need.

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.