Adopting a Table
In addition to creating tables in your Drupal database, the Data module can provide access to existing, non-Drupal tables by "adopting" the table. Adopted tables have the following functionality via Data:
- Row access in the Data Admin interface (Read/Write depending on drupal db user permissions)
- Views integration (tables with a primary key only)
In order to adopt any table in your database, the database user specified in your sites/default/settings.php files must have permissions to read that table. In order to permit writes, key and index management, the drupal user must also have write access to the desired table. Code 1 shows the SQL commands needed to expose a table to data in Postgresql.
Code 1: Exposing a table named "tmp_data_test" to user "drupal" in PostgreSQL.
grant all on tmp_data_test to drupal;
GRANT
In order to remove an adopted table, go to /admin/structure/data and click on "Disown" next to the table. Then go through to /admin/structure/views find the view related to your table, and click on "Edit". On the screen that opens, click on the drop down arrow next to "edit view name/description" and select "revert view".
Selecting "Drop" from the Data Tables view (/admin/structure/data) will drop the table from the database.
Help improve this page
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion