![Zyxware default image2](/sites/default/files/2021-10/Artboard%202%20copy%2011.png)
We were faced with a situation in one of our clients Drupal sites where we had to add View relationships programmatically with custom database tables. The site was running on Drupal 7. If you are faced with the same situation in your Drupal website and want to know how to add View relationships programmatically with custom database tables in Drupal 7 then read on to know the solution.