Finding and updating data sources in panels

We have several grafana servers. Over time, we have ended up with a mix of hand added and API provisioned data sources. Several are the same data source, but have a different name. I’m looking to standardize this.

I can update our data sources with puppet, but I don’t know of a good method of finding all the panels with the old data sources and updating them. I know there is a grafana sqlite3 db that stores the JSON for each panel. I can write something to go through those methodically and update them, but I’m wondering if there is an easier solution?

Thanks.