govbridge-api / test_db_fix.py
harshrawat18's picture
feat: ingestion fix
70bc888
Raw
History Blame Contribute Delete
571 Bytes
import os
from supabase import create_client
from dotenv import load_dotenv
load_dotenv('/workspaces/govbridge/.env')
sb = create_client(os.getenv('SUPABASE_URL'), os.getenv('SUPABASE_KEY'))
res = sb.table('schemes').select('id, title, full_description').execute()
for r in res.data:
if r['full_description'] and "Key Benefits:" in r['full_description']:
new_desc = r['full_description'].replace("Key Benefits:", "").strip()
sb.table('schemes').update({'full_description': new_desc}).eq('id', r['id']).execute()
print(f"Fixed {r['title']}")