{"id":22445,"library":"tenant-schemas-celery","title":"tenant-schemas-celery","description":"Celery integration for django-tenant-schemas and django-tenants. Automatically sets the schema on Celery task invocations so that tasks run in the correct tenant context. Current version is 4.0.3, supporting Python >=3.9. Release cadence is irregular, with major versions aligned with Django or Celery breaking changes.","status":"active","version":"4.0.3","language":"python","source_language":"en","source_url":"https://github.com/maciej-gol/tenant-schemas-celery","tags":["django","celery","multi-tenant","schema","postgres"],"install":[{"cmd":"pip install tenant-schemas-celery","lang":"bash","label":"Default install"}],"dependencies":[{"reason":"Required by the underlying tenant library","package":"Django","optional":false},{"reason":"Required for tenant context; or django-tenant-schemas (legacy)","package":"django-tenants","optional":false},{"reason":"Required for task queue integration","package":"Celery","optional":false}],"imports":[{"wrong":"from tenant_schemas_celery.app import CeleryApp","symbol":"CeleryApp","correct":"from tenant_schemas_celery import CeleryApp"}],"quickstart":{"code":"import os\nos.environ.setdefault('DJANGO_SETTINGS_MODULE', 'your_project.settings')\n\nfrom tenant_schemas_celery.app import CeleryApp\n\napp = CeleryApp('your_project')\napp.config_from_object('django.conf:settings', namespace='CELERY')\napp.autodiscover_tasks()","lang":"python","description":"Create a Celery app instance that automatically manages tenant schema context. Replace 'your_project' with your Django project name."},"warnings":[{"fix":"Upgrade to 4.0.0+ and use django-tenants instead of django-tenant-schemas.","message":"Version 4.0.0 dropped support for django-tenant-schemas (legacy) and Python <3.9. If you need the old package, pin to <4.0.0.","severity":"breaking","affected_versions":"<4.0.0"},{"fix":"Use app.Task to inherit tenant schema support in custom tasks, or set app.Task = YourCustomTask in CeleryApp.","message":"Version 3.0.0 introduced a custom task class via CeleryApp overriding the default Task class. If you have custom task base classes, they may not be applied unless you set the Task class explicitly.","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Replace with `from tenant_schemas_celery.app import CeleryApp`.","message":"Using `from tenant_schemas_celery import CeleryApp` is deprecated and will be removed. Import from the `app` submodule instead.","severity":"deprecated","affected_versions":">=4.0.0"},{"fix":"Ensure tasks are called from within a tenant context (e.g., inside a view or with `tenant_context()`) or manually set the schema.","message":"If you use `app.send_task()`, the tenant schema is set correctly. However, tasks called via `.delay()` or `.apply_async()` from outside a tenant context (e.g., in a management command) will fail if no active schema is set.","severity":"gotcha","affected_versions":"all"},{"fix":"Set `CELERY_BEAT_SCHEDULER = 'tenant_schemas_celery.schedulers.TenantAwareScheduler'` in Django settings.","message":"When using Celery Beat with django-celery-beat, the scheduler must be configured to use the tenant-schemas-celery scheduler to run tasks in the correct tenant context.","severity":"gotcha","affected_versions":">=2.1.0"}],"env_vars":null,"search_vec":"'3.9':39 '4.0.3':36 'align':47 'automat':16 'break':52 'cadenc':41 'celeri':4,5,21,51,55 'chang':53 'context':32 'correct':30 'current':33 'django':9,14,49,54 'django-ten':13 'django-tenant-schema':8 'integr':6 'invoc':23 'irregular':43 'major':45 'multi':57 'multi-ten':56 'postgr':60 'python':38 'releas':40 'run':27 'schema':3,11,19,59 'set':17 'support':37 'task':22,26 'tenant':2,10,15,31,58 'tenant-schemas-celeri':1 'version':34,46","created_at":"2026-04-27T17:05:12.951865+00:00","updated_at":"2026-04-27T17:05:12.951865+00:00","problems":{"verify_error":"Traceback (most recent call last):\n  File \"<string>\", line 1, in <module>\nImportError: cannot import name 'CeleryApp' from 'tenant_schemas_celery' (/tmp/tmp2i7weq8a/venv/lib/python3.12/site-packages/tenant_schemas_celery/__init__.py)"},"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"4.0.3","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/maciej-gol/tenant-schemas-celery","docs":null,"changelog":null,"pypi":"https://pypi.org/project/tenant-schemas-celery/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["database","web-framework","workflow"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"import_fail","verified_at":"2026-07-03","last_verified":"2026-07-03","next_check":"2026-07-10","install_tag":null}}