tripal/t4d8

Tripal DBX, Drupal Query Builder + guessing default database

laceysanderson opened this issue · 2 comments

This came up in #274. In PR #290 we added support/documentation for Tripal DBX to guess that even if the table is not prefixed in some cases you would want to use Chado anyway. For example, you should be able to do $connection->query("SELECT * FROM {feature}"); and even though it's not {1:feature} Tripal DBX should know to use Chado.

While the above case now works, the query builder does not seem to allow this right now. For example, $connection->select('feature', 'f') will not work as Tripal DBX is assuming this is a Drupal table. This is very noticable in automated testing where queries start failing with weird test12432342342 prefixes to the table name.

Using the same approach as in #290 doesn't work here since only the query builder classes show up in the backtrace.

In the meantime, using the 1 prefix to your table name fixes the problem. When this issue is fixed it will also update the existing places Tripal DBX query builder has been used.

For example,

$select = $chado->select('1:'.$chado_table, 'ct');

This has been fixed. More documentation will be added in tripal_doc