New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] - Support models from alternate database #95

Open
pixelchutes opened this Issue Oct 6, 2016 · 1 comment

Comments

Projects
None yet
1 participant
@pixelchutes
Copy link
Collaborator

pixelchutes commented Oct 6, 2016

It would be great if xPDO allowed working with models from an alternate database.

Today, if you want to work with addPackage() using a model stored in an alternate database, one way to accomplish this is to setup a secondary (or 3rd, or 4th...) xPDO connection.

Example:
https://rtfm.modx.com/extras/revo/cmpgenerator/cmpgenerator.foreign-databases

However, this is an inefficient way of attempting to access a table in an alternate database if it is already on the same server and the current connection's user has proper access permissions.

If there was a way for individual packages to override the database to use, it would open up new opportunities, or at the very least, become more efficient in some scenarios.

The best workaround I have found so far is to leverage a View:

CREATE VIEW local_db.custom_table AS SELECT * FROM foreign_db.custom_table;
@pixelchutes

This comment has been minimized.

Copy link
Collaborator

pixelchutes commented Jul 24, 2017

@opengeek in your experience, would you envision support for this feature a "large undertaking," or could someone less-versed in xPDO potentially assist?

I'm happy to contribute a working PR, but wondering if you could provide some recommendation on a starting point?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment