-
Notifications
You must be signed in to change notification settings - Fork 227
Closed
Description
Thanks for the implementation of batching - it was just what I was waiting for :)
I have a problem to enable batching for a relationship with primaryjoin & secondary settings.
I have this kind of a relationship in my ProjectTenant model:
roles = relationship(
TenantRole,
secondary='system_project_tenants_roles',
primaryjoin='and_('
'ProjectTenant.project_id == ProjectTenantRole.mt_project_id,'
'ProjectTenant.tenant_id == ProjectTenantRole.tenant_id'
')',
lazy='joined'
)
When I'm trying to enable batching for this field I'm getting this error:
Incorrect syntax near ','.DB-Lib error message 20018, severity 15:\nGeneral SQL Server error: Check messages from the SQL Server\n")
[SQL: SELECT system_project_tenants_1.mt_project_id AS system_project_tenants_1_mt_project_id, system_project_tenants_1.tenant_id AS system_project_tenants_1_tenant_id, system_tenants_roles.id AS system_tenants_roles_id
FROM system_project_tenants AS system_project_tenants_1 JOIN system_project_tenants_roles AS system_project_tenants_roles_1 ON system_project_tenants_1.mt_project_id = system_project_tenants_roles_1.mt_project_id JOIN system_tenants_roles ON system_tenants_roles.id = system_project_tenants_roles_1.tenant_role_id
WHERE (system_project_tenants_1.mt_project_id, system_project_tenants_1.tenant_id) IN ((%(primary_keys_1_1)s, %(primary_keys_1_2)s))s))
SQL Server doesn't support multi-columns in a WHERE IN clause (ref).
Maybe implement the tuple_ can be useful here?
Many thanks!
Metadata
Metadata
Assignees
Labels
No labels