This project is not covered by Drupal’s security advisory policy.

With drush entity you can query the entity system available for Drupal 8, 7 and (some of) 6.

Getting started

Install by using drush dl drush_entity. Next you can try commands like

drush entity-type-read
drush entity-type-read node
drush entity-read node 12

The following commands should work against Drupal 6, Drupal 7 and Drupal 8. Please report bugs when this is not the case.

drush entity-update node 3

drush entity-read node 3  |  less

#read in json format
drush entity-read node 3 --format=json

drush entity-type-read user

drush entity-type-read node --fields=label

drush entity-type-read user node --fields=label,bundles/*/label,drush/count

List all users with their name and mail

drush @drupal.d7 entity-read user `drush @drupal.d7 entity-read user` --fields=name,mail

Edit node title manually

drush @drupal.d7 entity-update node 53 --fields=title
drush @drupal.d7 entity-read node 53 --fields=title

Edit node title through STDIN

echo '{"title":"XXX"}' | drush --pipe @drupal.d7 entity-update node 53 --fields=title --json-input=-
drush @drupal.d7 entity-read node 53 --fields=title

You may use a file instead of STDIN

Demo video

You can also watch a video on demonstrating some features (It takes you 1 minute.)

A list of commands used in this video can be found on

Remaining tasks

#1005480: Create a new project to develop Drush entity support suggests a devel_generate approach but whilst working on the patch the create workflow tends to be a template driven one. That is

  1. Query ie an exisiting node drush --json entity-read node 1
  2. Remove values from the json which are to be replaced by new values
  3. Next edit the json with new values
  4. Run drush entity-create node /path/to/file/new-node.json

Files #1330504: Test the File entity

Project Information