Since TYPO3 uses doctrine it is possible to use tables from multiple databases in one instance (with some restrictions like no joins
).
But what is possible at all?
At the moment I need two external tables for an extension and instead of using them directly I import them to work locally as usual. But the importing has some draw backs.
Draw backs I can accept:
- the data is not live (changes to the external tables are imported later)
- the data is read only (changes are done externally anyway)
For importing I use ext:external_import
but there are some problems as not all data can be imported in a single run, and then there are errors (e.g. there are reports about duplicate keys, alas there are no duplicate keys in the external tables)
On the other hand I doubt I can use the external tables directly as they have not the usual TYPO3 structure (fields: 'uid', 'pid', 'tstamp', ...). (Maybe they can be mapped in a view?) (of course in the tables I import the data into these fields exist)
Also external changes may be unnoticed and cached content does not reflect current data. In my case that would be a minor problem, as we currently already have no 'live' data, but this needs to be cleaned regularly for cache and for the search index (solr).
What are possible solutions? ? (do they depend on the TYPO3 version?) What are your experiences?
EDIT:
While trying to realize it considering the given answers more doubts appear:
- the tables are readonly (as they are changed from outside):
How do I declare it to TYPO3? - the tables does not follow the usual name rules, especially one table is named
sys_category
which in this way conflicts with the TYPO3 tablesys_category
.
Can I build a mapping inside of TYPO3? - Can I build a view from TYPO3 for renaming tables and fields?
like:
CREATE View tx_myext_category
SELECT id as uid, name as title, ...
FROM databasename.sys_category;