ara icon indicating copy to clipboard operation
ara copied to clipboard

A way to merge databases (or multiple instances) into one -- or a way to export results from an instance and import them elsewhere

Open dmsimard opened this issue 1 year ago • 2 comments

I don't personally have a use case for this right now but it's something I've been asked about a lot so I am at least creating an issue for it :sweat_smile:

What is the idea ?

At a high level, the idea is to be able to run ansible playbooks with ara in different places, each saving to their own database (sqlite or not) and then a way to export them to another instance to aggregate the results after the fact.

The distributed sqlite backend kind of does that but it keeps the individual databases "sharded": it does not merge them such that all the results are viewable from a single web reporting interface or API server.

distributed_sqlite

We can't just blindly merge databases together -- there's primary keys (playbook IDs), foreign keys, etc. but a quick search about doing this with django projects suggests it is possible in different ways.

An approach that might work regardless of database backend could be to crawl everything available over the API and POST everything back to the another one. I expect this would be slow at scale and not without challenges like figuring out whether the data we're importing already exists so we're not importing it a second time :grimacing:

Anyway, this is an issue where we might consider what are the possible options and then figure something out.

If you need this, have ideas, suggestions or would like to contribute, feel free to comment here.

dmsimard avatar Feb 10 '23 17:02 dmsimard