bernardopires / django-tenant-schemas

Tenant support for Django using PostgreSQL schemas.
https://django-tenant-schemas.readthedocs.org/en/latest/
MIT License
1.45k stars 425 forks source link

Issue in holding DB connection consistently #698

Open kushal-chaurasia-godeskless opened 7 months ago

kushal-chaurasia-godeskless commented 7 months ago

So i have Django 2.2.6 psycopg2-binary===2.8.6 and python version 3.9.7 and when my celery task is getting executed I want to set tenant so for that i am querying in Client table and intermittently i am not able to find data in DB even tough data exist in my db what should i do

jeroenbrouwer commented 5 months ago

Write a wrapper around running your celery tasks, store the schema_name / tenant for which the task must run and run your task within a with schema_context(schema_name) context.