Skip to main content
drupalreleases

Use direct release data with your AI assistant.

Learn more

Database cross-schema query API

No security coverage Under active development 36 sites

This module enables your Drupal site to query data from other schemas or databases using Drupal's existing database API. It supports PostgreSQL and MySQL, allowing you to access tables across different schemas or databases that share the same connection credentials.

Synopsis

This modules provides an API for database cross-schema queries. It allows to query schema/database outside Drupal's schema (in the case of PostgreSQL or database in the case of MySQL) using the same database API provided by Drupal.

For instance, you have a Drupal site running on a PostgreSQL database "mydb". Drupal is installed in PostgreSQL "public" schema. With this module, you can use the same connection to query between multiple schemas at the same time (ie. in a same query) if you use other schemas "myschema1", "some_custom_data_schema_2", etc.

It also works with mysql at the difference that you would use the same connection to query multiple mySQL databases (ie. the same server, port and credential would work for them all).

Furthermore, it is also possible to run Drupal on PostgreSQL and query a MySQL database as long as its credentials are set in the site's settings.php file.

Note: you can only cross-query schemas/databases when they use the same connection (ie. same server+port+credentials).

Current state: beta version.
Database supported:
-PostgreSQL (tested functional)
-MySQL (tested functional)

Version 1.0.x was released for Drupal 8 and 9 and is obsolete now. Version 2.0.x works with both Drupal 9.4+ and Drupal 10 and does not support per-table prefixing (even with Drupal 9.4+ while it was just deprecated but supported by Drupal).

Requirements

Once the main module is enabled, you should also enable at least one external database driver (dbxschema_mysql or dbxschema_pgsql, provided with this module).

Roadmap

  • Better document the API
  • Add automated tests

Credits

The Alliance Bioversity - CIAT.

Restrictions

  • No more support for per-table prefixing used by Drupal 9 and older. The support was deprecated in Drupal 9 and new database driver module were introduced in 9.4 which lead to a rewrite of some parts of this module that removed the support for per-table prefix in "settings.php". If you really need per-table prefixing, send me a message to see what could be done.
  • Not working with very old versions of PostgreSQL and MySQL that don't support cross-schema/database queries.
Drupal 11 · not 10

Ask your assistant about Database cross-schema query API

Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works

Depends on

Dependencies of the latest stable release

No dependencies recorded for this project.

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
6
Tracked since
Jan 2023
Latest release
2 weeks ago
Releases (12 mo)
2 ▲ from 1
Maintenance
Active

Release Timeline

Releases

Version Type Core PHP Release date
2.1.0 Stable 11 Sep 21, 2026
2.1.x-dev Dev 10–11 Sep 14, 2026
2.0.0 Stable 10–11 Dec 3, 2024
2.0.0-beta3 Pre-release 9–10 Jan 20, 2023
2.0.0-beta2 Pre-release 9–10 Jan 13, 2023
2.0.0-beta1 Pre-release 9–10 Jan 13, 2023