Come together with the global Drupal community in Rotterdam, 28 Sept – 1 Oct 2026. Sessions, contribution, connection, and Early Bird savings until 8 June.
Can you be a little more explicit? You can implement a hook for copying data from an external database into your default database, and Table Wizard will make it available to views. If what you mean is to surface the data while it's still in the external database, that isn't currently supported but I'm thinking about it.
+1 to being able to link to an external database. It would be much easier than having to import the external DB with the internal one everytime it gets updated. If the external is constantly being updated this is even more difficult.
Any ideas on how you'd get the external to link in? (i know this feature request is not trivial)
It's going to be a challenge, Views won't handle it out-of-the-box (at least, it won't let a table in an external DB be a base table) - but we need this for a current project, so we'll find a way to get it done.
Would DBTNG in d7 make this easier to implement? If it is, maybe we can save time by building it with this in mind, so it doesn't have to totally rewritten for d7. Just a thought.
The dependency here is on Views, not the core database API. Moshe has picked up some ideas on how to do this, I'll be seeing what I can do with them soon.
I'm actively working on supporting data from external DBs this week. Status:
The Schema module, which does the table inspection our analysis feature depends on, does not currently support external databases. I've submitted a patch (#411538).
Views actually does support using a table from an external database as a base table.
I suspect that relationships among tables in the same external database will work just fine.
I am 99.9% certain that relationships between tables in different databases will not work - this will be the hard part.
I hope to have all but the last (hard) part committed within a day or two.
excellent! Seems that relationships between tables of different databases wouldn't be as critical. Will the id mapping still work (or is that a migrate module thing?)
Relationships between tables in different databases is critical for the project I'm being paid for right now...
The migrate module ID mapping shouldn't be affected.
I may be jumping the gun, but I've just committed a first draft of this support - I'd appreciate feedback on the behaviour and presentation. You need to define your external DB in $db_url - its tables will appear in the list. Relationships across DBs won't work at all - relationships between tables in an external DB can be created with a bit of pain:
Start view with one external table as the base.
Add a couple of fields from that table, then add the relationship.
Save your view now!
Try adding fields from the right-hand table to the view - things blow up.
Come back to the view - the fields actually were added, and seem to work fine.
The problem seems to be with displaying field options for fields in the second table...
Comments
Comment #1
mikeryanCan you be a little more explicit? You can implement a hook for copying data from an external database into your default database, and Table Wizard will make it available to views. If what you mean is to surface the data while it's still in the external database, that isn't currently supported but I'm thinking about it.
Comment #2
frankcarey commented+1 to being able to link to an external database. It would be much easier than having to import the external DB with the internal one everytime it gets updated. If the external is constantly being updated this is even more difficult.
Any ideas on how you'd get the external to link in? (i know this feature request is not trivial)
Comment #3
mikeryanIt's going to be a challenge, Views won't handle it out-of-the-box (at least, it won't let a table in an external DB be a base table) - but we need this for a current project, so we'll find a way to get it done.
Comment #4
qbnflaco commentedWould DBTNG in d7 make this easier to implement? If it is, maybe we can save time by building it with this in mind, so it doesn't have to totally rewritten for d7. Just a thought.
Comment #5
mikeryanThe dependency here is on Views, not the core database API. Moshe has picked up some ideas on how to do this, I'll be seeing what I can do with them soon.
Comment #6
mikeryanI'm actively working on supporting data from external DBs this week. Status:
I hope to have all but the last (hard) part committed within a day or two.
Comment #7
frankcarey commentedexcellent! Seems that relationships between tables of different databases wouldn't be as critical. Will the id mapping still work (or is that a migrate module thing?)
Comment #8
mikeryanRelationships between tables in different databases is critical for the project I'm being paid for right now...
The migrate module ID mapping shouldn't be affected.
I may be jumping the gun, but I've just committed a first draft of this support - I'd appreciate feedback on the behaviour and presentation. You need to define your external DB in $db_url - its tables will appear in the list. Relationships across DBs won't work at all - relationships between tables in an external DB can be created with a bit of pain:
The problem seems to be with displaying field options for fields in the second table...
Thanks.
Comment #9
mikeryanUpdate: the problem is a known bug in Views - apply the patch (#380560: Fatal error: Call to a member function get_handlers()) and joining external tables within a DB works just fine.
Comment #10
mikeryanA week without problems being reported, time to move on...