Skip to content

Cross-Database Automatic Joins Support in Nette\Database\Explorer #322

@JakubRichtr

Description

@JakubRichtr

Hi Nette team,

I’m exploring a use case where two MySQL schemas live on the same server, e.g.:

main_db.books

logs_db.users

In MySQL it’s perfectly valid to write SQL such as:

SELECT b.*, u.firstname
FROM main_db.books AS b
JOIN logs_db.users AS u ON b.author_id = u.id;

I’d like to use Nette\Database\Explorer “dot/colon” magic like:

$explorer->table('main_db.books')
    ->where('logs_db.users.firstname', 'Pepa');

or

$explorer->table('logs_db.users')
    ->where(':main_db.books(translator_id).title LIKE ?', '%PHP%');

Questions

Does Explorer currently support automatic joins across multiple databases/schemas on the same MySQL server?

If not, is the limitation purely architectural (e.g., Structure only reads information_schema for a single database) or are there other design reasons for not supporting this?

Context

The goal is to keep all the usual Explorer features (dot/colon notation, automatic JOIN detection, related(), etc.) while being able to reference tables across schemas when the DB engine supports fully-qualified names.

Thanks for clarifying whether this feature exists today or if it’s intentionally out of scope.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions