@User i am looking through this script again now, doing some planning for the migration. I have 2 UMH-instances running now so i will move data from the old one to the new. i will setup all grafana dashboards etc with the old data in the new format for validation and when i start to move all devices i need to push the last data to the new db.. i was thinking if i simply could add a WHERE timestamp > 'first move data' in this part to only push the latest data so i don't need to push all values again. in this part:
python
def fetch_total_tags(source_conn, table_name):
with source_conn.cursor() as cursor:
cursor.execute(f"SELECT COUNT(*) FROM public.{table_name};")
total = cursor.fetchone()[0]
return total