--- id: tenant-schemas-celery version: "5.0.0" license: MIT license_treatment: permissive maintenance: active --- # tenant-schemas-celery — Celery integration for django-tenant-schemas and django-tenants License: permissive · Maintenance: active · Downloads: 213.3K/mo ## What it is and what it does tenant-schemas-celery bridges Celery and multi-tenant applications by automatically injecting the current tenant's schema name into task arguments and restoring the correct schema context when tasks execute. This allows background jobs to operate safely within isolated tenant databases without manual schema switching. The package provides a drop-in CeleryApp subclass and a TenantTask base class that transparently handle schema context, plus optional schedulers for celery beat that iterate over all tenant schemas to run periodic tasks in each one. The package supports multiple databases, tenant object caching to reduce refetch overhead, and database-driven periodic task scheduling. It requires Python >=3.11 and Celery >=5. The codebase is stable and rarely updated, but maintainers respond quickly to issues. Use it for: - Run background jobs (email, reports, cleanup) for each tenant independently without cross-tenant data leakage. - Schedule periodic maintenance tasks across all tenants using celery beat. - Execute long-running operations asynchronously while preserving tenant isolation and schema context. - Store periodic task definitions per-tenant in the database for dynamic scheduling. - Cache tenant objects across task retries to reduce database queries in high-frequency scenarios. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Integrates Celery task queuing with multi-tenant Django applications to run asynchronous tasks within isolated tenant schemas, automatically managing schema context across task execution. Yes—if you use Celery with multi-tenant applications. The package is actively maintained, has no known vulnerabilities, low install friction, and solves the non-trivial problem of schema context management across async task boundaries. The MIT license imposes no restrictions. Install only if you are already committed to both Celery and a multi-tenant architecture; it adds no value as a standalone tool. ## Install pip install tenant-schemas-celery uv add tenant-schemas-celery poetry add tenant-schemas-celery ## Installing tenant-schemas-celery Before you install: Low friction: single runtime dependency (celery) and a pure-Python wheel. Actively maintained with a recent release (13 days old) and quick issue response, though infrequent commits suggest stable, feature-complete code rather than active development. License in practice: MIT license permits unrestricted use, modification, and distribution in commercial and private projects with minimal obligations—only attribution required. Quickstart: pip install tenant-schemas-celery from tenant_schemas_celery.app import CeleryApp as TenantAwareCeleryApp app = TenantAwareCeleryApp() app.config_from_object('django.conf:settings') @app.task def my_task(): print(connection.schema_name) Requires Python >=3.11, a multi-tenant application using django-tenants, and a running Celery worker. Verify before relying: - Whether tenant object caching (tenant_cache_seconds) significantly improves performance in production workloads. - Behavior and deadlock risk when celery beat attempts to schedule tasks for newly created tenants before migrations complete. - Compatibility with specific versions of django-tenants and whether the package is tested against the latest releases. ## Package facts - License: MIT (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 213.3K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags celery multi-tenant tasks, tenant-aware async tasks, celery schema context, multi-tenant background jobs, tenant schema task routing, celery task isolation, async tasks per tenant, multi-tenant, task-queue, celery-integration [View on SkillFed](https://skillfed.io/packages/tenant-schemas-celery) · [View on PyPI](https://pypi.org/project/tenant-schemas-celery/)