Installation¶
This guide covers how to install pgqrs for both Rust and Python projects.
Prerequisites¶
- PostgreSQL 12+ - pgqrs uses
SKIP LOCKEDand other features from PostgreSQL 12+ - A PostgreSQL database you have access to (local, Docker, or cloud-hosted)
Library Installation¶
PostgreSQL Setup¶
Option 1: Docker (Recommended for Development)¶
# Start a PostgreSQL container
docker run --name pgqrs-postgres \
-e POSTGRES_PASSWORD=postgres \
-p 5432:5432 \
-d postgres:15
# Connection string
# postgresql://postgres:postgres@localhost:5432/postgres
Option 2: Local PostgreSQL¶
Install PostgreSQL using your system package manager:
Option 3: Cloud PostgreSQL¶
pgqrs works with any PostgreSQL-compatible database:
- AWS RDS - Get connection string from RDS console
- Google Cloud SQL - Get connection string from Cloud Console
- Azure Database for PostgreSQL - Get connection string from Azure portal
- Supabase - Get connection string from project settings
- Neon - Get connection string from dashboard
Installing the pgqrs Schema¶
Before using pgqrs, you need to install its schema in your database. You can do this via the CLI or programmatically.
use pgqrs::{Admin, Config};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let config = Config::from_dsn("postgresql://localhost/mydb")?;
let admin = Admin::new(&config).await?;
// Install schema
admin.install().await?;
// Verify installation
admin.verify().await?;
println!("Schema installed successfully!");
Ok(())
}
Custom Schema¶
By default, pgqrs creates tables in the public schema. To use a custom schema:
What's Next?¶
- Quickstart - Create your first queue and send messages
- Architecture - Understand how pgqrs works