Query across many tenants

I am developing an application with postgres attribute multitenancy and there is one query that I want to make across multiple tenants (tenants will be provided as argument) I was wandering if there is a way to do that somewhat simpler and more idiomatic, then just making a custom query and running a query multiple times. I also have nested fields to resolve for each element, so I would need to resolve every dependency somehow too.
Solution:
You can make specific read actions allow bypassing multitenancy with multitenancy :bypass
Jump to solution
5 Replies
Solution
ZachDaniel
ZachDaniel3mo ago
You can make specific read actions allow bypassing multitenancy with multitenancy :bypass
ZachDaniel
ZachDaniel3mo ago
and then you can filter where attribute in [....] no need for multiple queries. Someone just PRd a feature where you can set that to :bypass_all which bypasses the tenant for all nested queries.
Vahagn
VahagnOP3mo ago
So If I just bypass on the top query and load many things inside, the queries inside it will not be bypassed?
ZachDaniel
ZachDaniel3mo ago
They will be well, if you use :bypss_all Ah, so in your case you may need to run many queries if you want each resulting thing to load related data as if it was tenanted
Vahagn
VahagnOP3mo ago
Ok, got it, thanks a lot

Did you find this page helpful?