Skip to content

LLM-Driven Extraction of Unstructured Data — Built for API Deployments & ETL Pipeline Workflows

fix: Deprecated django tenant schema function replaced (#647)

Chandrasekharan Mc9bfbfda411b
diff --git a/backend/api/deployment_helper.py b/backend/api/deployment_helper.py
index b1b9a521e..494eb002e 100644
--- a/backend/api/deployment_helper.py
+++ b/backend/api/deployment_helper.py
@@ -89,7 +89,7 @@ class DeploymentHelper(BaseAPIKeyValidator):
Returns:
- str: The complete API endpoint URL.
"""
- org_schema = connection.get_tenant().schema_name
+ org_schema = connection.tenant.schema_name
return f"{ApiExecution.PATH}/{org_schema}/{api_name}/"
@staticmethod
diff --git a/backend/api/models.py b/backend/api/models.py
index 2119ff85b..a6f417fef 100644
--- a/backend/api/models.py
+++ b/backend/api/models.py
@@ -87,12 +87,12 @@ class APIDeployment(BaseModel):
try:
original = APIDeployment.objects.get(pk=self.pk)
if original.api_name != self.api_name:
- org_schema = connection.get_tenant().schema_name
+ org_schema = connection.tenant.schema_name
self.api_endpoint = (
f"{ApiExecution.PATH}/{org_schema}/{self.api_name}/"
)
except APIDeployment.DoesNotExist:
- org_schema = connection.get_tenant().schema_name
+ org_schema = connection.tenant.schema_name
self.api_endpoint = f"{ApiExecution.PATH}/{org_schema}/{self.api_name}/"
super().save(*args, **kwargs)
diff --git a/backend/api_v2/deployment_helper.py b/backend/api_v2/deployment_helper.py
index e94c84e46..4c6d1698b 100644
--- a/backend/api_v2/deployment_helper.py
+++ b/backend/api_v2/deployment_helper.py
@@ -134,7 +134,7 @@ class DeploymentHelper:
Returns:
- str: The complete API endpoint URL.
"""
- org_schema = connection.get_tenant().schema_name
+ org_schema = connection.tenant.schema_name
return f"{ApiExecution.PATH}/{org_schema}/{api_name}/"
@staticmethod
diff --git a/backend/pipeline/models.py b/backend/pipeline/models.py
index 8860d027a..bf0dc5494 100644
--- a/backend/pipeline/models.py
+++ b/backend/pipeline/models.py
@@ -91,7 +91,7 @@ class Pipeline(BaseModel):
@property
def api_endpoint(self):
- org_schema = connection.get_tenant().schema_name
+ org_schema = connection.tenant.schema_name
deployment_endpoint = settings.API_DEPLOYMENT_PATH_PREFIX + "/pipeline/api"
api_endpoint = f"{deployment_endpoint}/{org_schema}/{self.id}/"
return api_endpoint
diff --git a/backend/platform_settings/platform_auth_service.py b/backend/platform_settings/platform_auth_service.py
index 054291ba8..318c23591 100644
--- a/backend/platform_settings/platform_auth_service.py
+++ b/backend/platform_settings/platform_auth_service.py
@@ -155,7 +155,7 @@ class PlatformAuthenticationService:
error: IntegrityError
"""
try:
- organization = connection.get_tenant()
+ organization = connection.tenant
platform_key.modified_by = user
if action == PlatformServiceConstants.ACTIVATE:
active_keys: list[PlatformKey] = PlatformKey.objects.filter(
@@ -193,7 +193,7 @@ class PlatformAuthenticationService:
Any: List of platform keys.
"""
try:
- organization_id = connection.get_tenant().id
+ organization_id = connection.tenant.id
platform_keys: list[PlatformKey] = PlatformKey.objects.filter(
organization=organization_id
)
diff --git a/backend/platform_settings/views.py b/backend/platform_settings/views.py
index 6b4c918fa..8745eafd1 100644
--- a/backend/platform_settings/views.py
+++ b/backend/platform_settings/views.py
@@ -109,7 +109,7 @@ class PlatformKeyViewSet(viewsets.ModelViewSet):
is_active = request.data.get(PlatformServiceConstants.IS_ACTIVE)
key_name = request.data.get(PlatformServiceConstants.KEY_NAME)
- organization: Organization = connection.get_tenant()
+ organization: Organization = connection.tenant
PlatformAuthHelper.validate_token_count(organization=organization)