Spaces:
Sleeping
Sleeping
Download seed.py from brocode12/bell-backend: direct link, hf CLI and curl.
- Browser
- Download file 759 Bytes
-
https://huggingface.co/spaces/brocode12/bell-backend/resolve/main/seed.py
- Command line
-
hf download hf://spaces/brocode12/bell-backend/seed.py
-
curl -L -o seed.py https://huggingface.co/spaces/brocode12/bell-backend/resolve/main/seed.py
759 Bytes
| """One-off seeding script — loads data/byg_menu.json into Supabase. | |
| Run manually after applying database/schema.sql: | |
| python seed.py | |
| Never runs at startup; restarts must not touch production data. | |
| """ | |
| import sys | |
| import config | |
| from store import load_menu_from_file | |
| def main(): | |
| if not config.supabase_configured(): | |
| sys.exit("SUPABASE_URL / SUPABASE_SERVICE_KEY not set — nothing to seed.") | |
| from supabase import create_client | |
| client = create_client(config.SUPABASE_URL, config.SUPABASE_SERVICE_KEY) | |
| items = load_menu_from_file() | |
| res = client.table("menu_items").upsert(items, on_conflict="name,category").execute() | |
| print(f"Seeded {len(res.data)} menu items into Supabase.") | |
| if __name__ == "__main__": | |
| main() | |