PREFECT_API_DATABASE_CONNECTION_URL='sqlite+aiosqlite:///${PREFECT_HOME}/prefect.db'
PREFECT_API_DATABASE_ECHO='False'
@@ -13562,15 +13600,15 @@ Database settings
-To connect Prefect to a PostgreSQL database, you can set the following environment variable:
+Save a setting to your active Prefect profile with prefect config set
.
+Configure a PostgreSQL database
+Connect Prefect to a PostgreSQL database by setting the following environment variable:
prefect config set PREFECT_API_DATABASE_CONNECTION_URL="postgresql+asyncpg://postgres:yourTopSecretPassword@localhost:5432/prefect"
-The above environment variable assumes that:
+The above environment variable assumes:
- You have a username called
postgres
- Your password is set to
yourTopSecretPassword
@@ -13578,8 +13616,8 @@
-Quick start: configuring a PostgreSQL database with Docker
-To quickly start a PostgreSQL instance that can be used as your Prefect database, use the following command, which will start a Docker container running PostgreSQL:
+Quickstart: configure a PostgreSQL database with Docker
+Quickly start a PostgreSQL instance to use as your Prefect database with the following command (which will start a Docker container running PostgreSQL):
docker run -d --name prefect-postgres -v prefectdb:/var/lib/postgresql/data -p 5432:5432 -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=yourTopSecretPassword -e POSTGRES_DB=prefect postgres:latest
@@ -13592,14 +13630,14 @@
Quick start:
Creates a database prefect
with a user postgres
and yourTopSecretPassword
password.
Mounts the PostgreSQL data to a Docker volume called prefectdb
to provide persistence if you ever have to restart or rebuild that container.
-
Then you'll want to run the command above to set your current Prefect Profile to the PostgreSQL database instance running in your Docker container.
+
Run the command below to set your current Prefect Profile to the PostgreSQL database instance running in your Docker container.
prefect config set PREFECT_API_DATABASE_CONNECTION_URL="postgresql+asyncpg://postgres:yourTopSecretPassword@localhost:5432/prefect"
-
Confirming your PostgreSQL database configuration
-
Inspect your Prefect profile to confirm that the environment variable has been set properly:
+
Confirm your PostgreSQL database configuration
+
Inspect your Prefect profile to confirm that the environment variable has been properly set:
prefect config view --show-sources
@@ -13614,14 +13652,13 @@
Confirming your Postg
-Start the Prefect server and it should begin to use your PostgreSQL database instance:
+Start the Prefect server to use your PostgreSQL database instance:
In-memory database
-One of the benefits of SQLite is in-memory database support.
To use an in-memory SQLite database, set the following environment variable:
prefect config set PREFECT_API_DATABASE_CONNECTION_URL="sqlite+aiosqlite:///file::memory:?cache=shared&uri=true&check_same_thread=false"
@@ -13634,9 +13671,9 @@ In-memory database
Prefect uses Alembic to manage database migrations. Alembic is a
-database migration tool for usage with the SQLAlchemy Database Toolkit for Python. Alembic provides a framework for
+database migration tool to use with the SQLAlchemy Database Toolkit for Python. Alembic provides a framework for
generating and applying schema changes to a database.
-To apply migrations to your database you can run the following commands:
+Apply migrations to your database with the following commands:
To upgrade:
prefect server database upgrade -y
@@ -13649,8 +13686,8 @@ Migrations