Data Isolation
What does "Tenant" mean to us?
Combination of:
County
State
Municipality
What about use Row Level Security (RLS)?
Row Level Security (RLS) is a technique used in databases to control access to individual rows based on user privileges and permissions. With RLS, access to specific rows in a table can be selectively restricted, allowing for the implementation of row-level security policies.
When implementing RLS, security rules are defined to specify which rows can be accessed by each user or role. These rules can be based on various criteria such as specific columns in the table or user attributes. When a query or modification is performed in the database, the database engine automatically applies the RLS rules to filter the rows that the user is allowed to view or modify.
RLS provides an additional layer of row-level security and access control in the database, allowing for greater granularity in data security management. It is especially useful in applications and systems where sensitive data is handled and more precise access control is required.
Here more information: Row-Level Security - SQL Server | Microsoft Learn
Examples about how to implement with AWS and PostgreSQL: Multi-tenant data isolation with PostgreSQL Row Level Security | AWS Database Blog
Relational Diagram for the multi-tenant approach:
Request Flow with the multi-tenant approach: