Skip to content
Back

Query multi-tenant db with $permissions as attribute

  • 0
  • Databases
Joey Joe Joe
15 Mar, 2026, 18:25

I'm setting up a multi-tenant database with RLS enabled. My users my have permissions set for multiple Teams, and as such when they query the database with the default $permissions set, they'll end up seeing data for multiple teams in one request.

When trying to query my TablesDB.listRows call to include a Query.contains for $permissions and my team ID (team:${getTeamId()}), I get "Attribute not found in schema: $permissions.

Is the assumption that $permissions isn't a queriable row attribute? Is there any way to handle multi-tenancy without having to update every single table to have a "tenant_id" column?

TL;DR
Setup multi-tenant database with RLS enabled. Users have permissions for multiple teams. Attempted querying TablesDB.listRows with Query.contains for $permissions and team ID, but received "Attribute not found in schema: $permissions". Possible solution: Use a "tenant_id" column in every table to handle multi-tenancy.
Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more