Mads Vestergaard
02/04/2025, 9:32 AMMarvin
02/04/2025, 9:32 AMbash
export PREFECT_API_DATABASE_CONNECTION_URL="<postgresql+asyncpg://user:password@localhost/prefect_db>"
3. Migrate the Database:
- Prefect uses Alembic for database migrations. Run the migration commands to set up your PostgreSQL database schema:
bash
prefect database upgrade
4. Transfer Data:
- You'll need to manually transfer your data from SQLite to PostgreSQL. This may involve exporting data from SQLite and importing it into PostgreSQL using tools like pgloader
or custom scripts.
5. Verify Configuration:
- Ensure your Prefect server is running with the new configuration and test your flows to confirm everything is working as expected.
For more detailed instructions and considerations, you can refer to the Prefect self-hosting documentation.
Keep in mind that Prefect 3.x has some changes from previous versions, such as replacing agents with workers and using pydantic 2. Ensure your setup is compatible with these changes. More gotchas can be found here.Mads Vestergaard
02/04/2025, 9:36 AMMarvin
02/04/2025, 9:36 AMpostgresql+asyncpg
, for compatibility. You can start a PostgreSQL instance using the latest version of the official PostgreSQL Docker image, which is confirmed to be compatible. For more details, you can refer to the self-hosting guide.