def get_metadata(self, config):
        from sqlalchemy import MetaData
        odm = self.app.odm()
        metadata = {}

        for key, db_engine in odm.keys_engines():
            if not key:
                key = 'default'
            metadata[key] = meta = MetaData()
            for table, engine in odm.binds.items():
                if engine == db_engine:
                    table.tometadata(meta)

        config.metadata = metadata
MetaData object stored in odm extension contains aggregated data
dataset/ETHPy150Open quantmind/lux/lux/extensions/odm/commands/alembic.py/Command.get_metadata