Migrating from sqlite to postgres

We have a Grafana 10.2.2 installation originally installed on sqlite and I want to move that over to our postgresql cluster. I’ve looked around for solutions, but I can’t find anything that works. I tried with GitHub - percona/grafana-db-migrator: Grafana SQLite to Postgres Database Migrator and it rewrites a lot of stuff but doesn’t work at the end. Any idea how I can accomplish this? I really don’t want to remake all the dashboards.

PS: Data is fetched from other sources, so that’s fine.

is it the same as this one? Do you have a lot of stuff going on in your grafana? including alerts?

Not the same, but looks like I may be able to use it with some work. It’s made for MySQL/MariaDB, but as I said, I’m using PostgreSQL, so the SQL syntax is a wee bit different.

One other thing - I have setup the new grafana server with the same plugins, but the old one has a total of 84 tables in the db, whereas the new one only has 64. One has been excluded, but specifically, these are missing in the new db

dashboard_public_email_share
dashboard_public_magic_link
dashboard_public_session
dashboard_public_usage_by_day
dashboard_usage_by_day
dashboard_usage_sums
data_source_acl
data_source_cache
data_source_usage_by_day
license_token
recording_rules
remote_write_targets
report
report_dashboards
report_settings
setting
team_group
user_dashboard_views
user_stats

1 Like

And now, what is this?

INSERT INTO dashboard_version (“id”,“dashboard_id”,“parent_version”,“restored_from”,“version”,“created”,“created_by”,“message”,“data”) VALUES (372,29,10,0,11,‘2023-07-07 10:21:39’,52,replace(‘Lagt til terskelverdier:\nRød 0 - 35\nGul 35 - 40\nGrønn 40 -50\nRød 50 ->’,‘\n’,char(10)),'{“annotations”:{“list”:[{“builtIn”:1,“datasource”:{“type”:“grafana”,“uid”:“-- Grafana --”},“enable”:true,“hide”:true,“iconColor”:“rgba(0, 211, 255, 1)”,“name”:“Annotations \u0026 Alerts”,“target”:{“limit”:100,“matchAny”:false,“tags”:,“type”:“dashboard”},“type”:“dashboard”}]},“editable”:true,“fiscalYearStartMonth”:0,“graphTooltip”:0,“id”:29,“links”:,“liveNow”:false,“panels”:[{“datasource”:{“type”:“alexanderzobnin-zabbix-datasource”

That’s a function call in the dump - should it be there?

1 Like

Btw, the text just means ‘Added threashold values:\nRed 0 - 35\nYellow 35-40\nGreen 40-50\nRed 50 ->’

1 Like