<@ULVA73B9P> what the Redis version requirements f...
# ask-marvin
h
@Marvin what the Redis version requirements for prefect?
m
thought for 239.5 seconds
Short answer - There’s no hard, published Redis server “minimum” in Prefect 3.x docs, but Prefect’s Redis-backed features use Redis Streams, so you need Redis 5.0+ at a minimum. For best compatibility and features (e.g., XAUTOCLAIM), use Redis 6.2+ (Redis 7.x recommended). - The Python client constraint comes via the integration: installing Prefect’s Redis extra pulls prefect-redis, which requires redis-py >= 6.0.0. Details - Server versions - Minimum implied by features: Redis 5.0+ (Streams and consumer groups). - Recommended: Redis 6.2+ or 7.x (adds XAUTOCLAIM and other improvements). - Prefect itself doesn’t require you to run Redis unless you’re self-hosting Prefect Server in a multi-server setup (Redis is used for event messaging). See Self-hosted guide. - Python client (redis-py) - Installing the Redis extra brings in the prefect-redis integration which depends on redis>=6.0.0. - Install with:
Copy code
pip install "prefect[redis]"
- Docs - Prefect Redis integration overview and install: https://docs.prefect.io/integrations/prefect-redis/ - Self-hosted architecture (where Redis is needed): https://docs.prefect.io/v3/advanced/self-hosted/ Quick check - If you’re on Redis 5.x: core Streams-based features work, but some niceties (like XAUTOCLAIM) are only in 6.2+. - If you’re starting fresh: use Redis 7.x. If you can share whether you’re using Prefect Cloud or self-hosting (and which features you plan to use), I can confirm whether Redis is needed at all and pin a precise version recommendation.
h
@Marvin What is the PostgreSql requirements? How can I create table manually on PostgreSQL, I am not able manage db using alembic?
m
thought for 190.5 seconds
Here’s what you need for PostgreSQL with Prefect 3.x and how to proceed if you can’t run Alembic. PostgreSQL requirements - Minimum for multi-server (production) deployments: PostgreSQL 14.9 or higher - This is the tested/supported baseline for scaled, self-hosted Prefect Server. - Doc ref: Self-hosted guide - Single-server: SQLite is the default; you can use PostgreSQL as well, but the 14.9+ guidance still applies if you plan to scale. Connection configuration (Postgres) - Use an async SQLAlchemy URL (asyncpg driver is required):
Copy code
export PREFECT_API_DATABASE_CONNECTION_URL="<postgresql+asyncpg://user:password@host:5432/prefect>"
- Settings reference (includes all DB settings and TLS/connect args): https://docs.prefect.io/v3/api-ref/settings-ref Managing the schema without running Alembic directly Manual “hand-written” table creation is not supported and will lead to schema drift. Instead, if you cannot execute Alembic in your environment, generate the SQL from Prefect’s CLI and run it yourself, then stamp the DB so Prefect knows the migration state. 1) Generate SQL for the current head without applying it
Copy code
prefect server database upgrade --dry-run -y > prefect_migrations.sql
- This emits the exact SQL Alembic would run (CREATE TABLEs, indexes, etc.). - You can review or modify this file if your environment requires it. 2) Apply the SQL to PostgreSQL yourself
Copy code
psql "host=... port=5432 dbname=prefect user=... password=..." -f prefect_migrations.sql
- Ensure your DB user has privileges to CREATE/ALTER/DROP tables, indexes, and sequences. 3) Stamp the database to mark migrations as applied
Copy code
prefect server database stamp head
- This writes the appropriate row to the
alembic_version
table so Prefect won’t try to re-apply the same migrations later. Helpful CLI commands (verified) - Upgrade (applies migrations automatically if you can run Alembic):
Copy code
prefect server database upgrade -y
Use
--dry-run
to inspect SQL first. - Reset (drop and recreate everything):
Copy code
prefect server database reset -y
- Stamp a revision (after manual SQL apply):
Copy code
prefect server database stamp head
- If you’re running multiple API servers, disable auto-migrations on start and run them once, separately:
Copy code
export PREFECT_API_DATABASE_MIGRATE_ON_START=false
Operational tips - Long migrations on big tables can time out; increase timeout:
Copy code
export PREFECT_API_DATABASE_TIMEOUT=600
- If you use a connection pooler like PgBouncer (transaction mode), set asyncpg’s statement cache to 0 via connect args. See the settings reference for SQLAlchemy connect args. Links - Self-hosted architecture and requirements: https://docs.prefect.io/v3/advanced/self-hosted/ - Settings reference (DB URL, SQLAlchemy, TLS, timeouts): https://docs.prefect.io/v3/api-ref/settings-ref If you can share what’s preventing Alembic from running (error message, environment constraints), I can tailor the exact offline/SQL approach for your setup and confirm any additional steps you’ll need. Are you running a single server or a multi-server (HA) deployment?