Chris Marriott
05/26/2026, 10:39 AMMarvin
05/26/2026, 10:39 AMMarvin
05/26/2026, 10:41 AMPREFECT_SERVER_DATABASE_CONNECTION_URL should look like postgresql+asyncpg://....
If it’s falling back to SQLite, it will look like sqlite+aiosqlite:///..., often something like ~/.prefect/prefect.db.
Quick check:
bash
echo $PREFECT_SERVER_DATABASE_CONNECTION_URL
env | grep -i "PREFECT_SERVER_DATABASE\|PREFECT_API_DATABASE"
Or from Python:
bash
python -c "from prefect.settings import get_current_settings; print(get_current_settings().server.database.connection_url)"
2. Check what Prefect resolved at runtime
This is the clearest verification:
bash
python -c "
from prefect.settings import get_current_settings
from prefect.server.utilities.database import get_dialect
url = get_current_settings().server.database.connection_url.get_secret_value()
dialect = get_dialect(url)
print(f'Database URL: {url}')
print(f'Dialect: {dialect.name}')
"
You should see either:
- Dialect: postgresql
- Dialect: sqlite
3. Check for the default SQLite file
If Prefect fell back to SQLite, you’ll usually find:
bash
ls -lh ~/.prefect/prefect.db
If that file exists and is being updated while the server is running, that’s a strong sign you’re on SQLite.
You can also inspect it:
bash
sqlite3 ~/.prefect/prefect.db ".tables"
4. Inspect your Postgres directly
If you expect Postgres, connect to it and see whether Prefect tables exist:
bash
psql -h <host> -U <user> -d <database_name> -c "\dt"
If you see Prefect tables there, your server is likely using Postgres.
5. Watch server behavior/logs
SQLite has some special behavior in Prefect:
- request limiting middleware is applied to reduce SQLite lock contention
- you may see SQLite-style locking symptoms under load
- multi-worker server setups are not appropriate with SQLite
Postgres won’t use that SQLite-specific path.
Most important thing to know
In Prefect 3.x, if you don’t explicitly configure the server DB, Prefect defaults to SQLite.
So the simplest answer is:
- if connection_url resolves to postgresql+asyncpg://... → you’re on Postgres
- if it resolves to sqlite+aiosqlite:///... → you’re on SQLite fallback
Recommended quick diagnostic
bash
python -c "
from prefect.settings import get_current_settings
from prefect.server.utilities.database import get_dialect
settings = get_current_settings()
url = settings.server.database.connection_url.get_secret_value()
print('Resolved DB URL:', url)
print('Resolved DB dialect:', get_dialect(url).name)
"
Relevant docs:
- Self-host Prefect: configure a database
- Prefect self-hosting guides
If you want, I can also help you check a specific Docker Compose / Helm / environment setup to confirm whether it’s correctly pointing at Postgres.