Skip to content

Commit 844c6ff

Browse files
committed
Fix join condition for project storage allow
1 parent 34b42fc commit 844c6ff

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

  • components/renku_data_services/data_connectors

components/renku_data_services/data_connectors/db.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from typing import TypeVar
99

1010
from cryptography.hazmat.primitives.asymmetric import rsa
11-
from sqlalchemy import ColumnExpressionArgument, Select, delete, exists, func, or_, select
11+
from sqlalchemy import ColumnExpressionArgument, Select, delete, exists, func, or_, select, and_
1212
from sqlalchemy.ext.asyncio import AsyncSession
1313
from sqlalchemy.orm import joinedload
1414
from ulid import ULID
@@ -635,7 +635,10 @@ async def get_project_storage_allow(
635635
.join(ProjectORM, ProjectORM.id == schemas.ProjectStorageAllowORM.project_id)
636636
.join(
637637
ns_schemas.EntitySlugORM,
638-
ns_schemas.EntitySlugORM.project_id == schemas.ProjectStorageAllowORM.project_id,
638+
and_(
639+
ns_schemas.EntitySlugORM.project_id == schemas.ProjectStorageAllowORM.project_id,
640+
ns_schemas.EntitySlugORM.data_connector_id.is_(None),
641+
),
639642
)
640643
.join(ns_schemas.NamespaceORM, ns_schemas.NamespaceORM.id == ns_schemas.EntitySlugORM.namespace_id)
641644
.where(schemas.ProjectStorageAllowORM.project_id == project_id)
@@ -664,7 +667,10 @@ async def get_project_storage_allows(
664667
.join(ProjectORM, ProjectORM.id == schemas.ProjectStorageAllowORM.project_id)
665668
.join(
666669
ns_schemas.EntitySlugORM,
667-
ns_schemas.EntitySlugORM.project_id == schemas.ProjectStorageAllowORM.project_id,
670+
and_(
671+
ns_schemas.EntitySlugORM.project_id == schemas.ProjectStorageAllowORM.project_id,
672+
ns_schemas.EntitySlugORM.data_connector_id.is_(None),
673+
),
668674
)
669675
.join(ns_schemas.NamespaceORM, ns_schemas.NamespaceORM.id == ns_schemas.EntitySlugORM.namespace_id)
670676
)

0 commit comments

Comments
 (0)