Using gorm for loading a pg_dump sql dump on (Fiber) app start

37 Views Asked by At

I've recently re-written a db api in Fiber using gorm as the ORM (which I a very happy with. ).

At app spin up, I have a number of static tables that provide non-changing values of lookups (observatories, telescopes, filters etc) for the ingest that is part of th ebackend.

In the first iteration of the app (FastAPI) I loaded these via alembic as static csv files, and I imagine I can do the same via gorm via reading the files and structs, but since gorm has better raw sql support it seems, is there a way to simply load a sql dump of the postgres DB a la pg_dump directly (or similar)?

Searched the docs, some tuts, and here on SO but struck out. While my google-fu is not strong, I imagine there must be a way to do this more easily than the load the csv's approach. How have other people normally handled this (pretty common, I imagine) requirement of setting up some static data in the database at start?

thanks!

0

There are 0 best solutions below