[Drupal] What is the usage of drupal_write_record function in Drupal 7? Drupal Technical | 1 min read The drupal_write_record function is used to insert or update a record in the database based on the schema of the table. It helps in executing less database query. Let's take a look at the function given below.