Migrating single category with all events and attachments

Hi everyone,

I would like to copy/move all events with their minutes and attachments of one category (plus its sub-categories) from one indico installation to another. Both are “institutional installations” with quite a few categories, so a database dump and re-import is probably not an option.
The aim is to preserve the history of events and associated materials in a category that will live on in a new installation/server, so preserving category and event IDs is not a requirement,
Manual export of all events would be very tedious as there are several hundred, so any programmatic solution would be much appreciated.
What options do I have to accomplish this?


Check the event import/export CLIs:

  • indico event export --help
  • indico event import --help

They are for individual events but you could somewhat easily use indico shell to get all event ids from a given category subtree:

events = Event.query.filter(~Event.is_deleted, Event.category_chain_overlaps(CATEGORY_ID)).all()
ids = {e.id for e in events}

Then programmatically run the exports, and then import them on your other instance.

I haven’t tested it, but this should work to automate the exports instead of calling the CLI for each event:

from indico.modules.events.export import export_event
events = Event.query.filter(~Event.is_deleted, Event.category_chain_overlaps(CATEGORY_ID)).all()
for event in events:
    with open(f'/tmp/event-{event.id}.ind', 'wb') as target_file:
        export_event(event, target_file)