Charles Leung
05/01/2024, 6:16 PMMarvin
05/01/2024, 6:17 PMprefect
.
3. Configuring Prefect to use PostgreSQL:
- Set the PREFECT_API_DATABASE_CONNECTION_URL
environment variable with your PostgreSQL connection details. Here's an example format for the environment variable:
export PREFECT_API_DATABASE_CONNECTION_URL="postgresql+asyncpg://<USERNAME>:<PASSWORD>@<HOST>:<PORT>/<DATABASE>"
Replace <USERNAME>
, <PASSWORD>
, <HOST>
, <PORT>
, and <DATABASE>
with your own PostgreSQL credentials and details.
Here's a provided example assuming standard credentials and local PostgreSQL setup:
export PREFECT_API_DATABASE_CONNECTION_URL="<postgresql+asyncpg://postgres:yourTopSecretPassword@localhost:5432/prefect>"
Make sure to replace yourTopSecretPassword
with the actual password for your postgres
user.
For more details, you can refer to the Prefect documentation on hosting.
Remember that the postgresql+asyncpg
scheme is for asynchronous communication with PostgreSQL, which Prefect supports. If you're using synchronous libraries or tools that expect a synchronous connection, you would use a different URL scheme, like postgresql://
.
Keep in mind that if you choose to use PostgreSQL, you should also ensure you have the pg_trgm
extension installed and enabled in your PostgreSQL instance, as Prefect uses this extension.