Change datasource but keep panel settings

I have a panel with an sql datasource, lets say mssql, but want to change this to another sql datasource, lets say sqlite. When I edit the panel and select the other datasource, my settings are deleted, particularly the sql query.

Is there a way to keep all of the settings, besides manually copy-paste of everything?

welcome @marcus2945

instead of manually doing via the UI, try modifying it via the grafana api or manually edit the dashboard json

Thank you so much Josiah.

I was hoping for a way to use the Grafana UI, without erasing the sql query. If there is any.