Skip to content
Community forum

One live Postgres table holds rows for several of our tenants

SolvedSupero SupportSupero team asked

Common question, written up by the Supero team.

Our customers table has an org_id column, and each org is a tenant in Supero. The table is live_read. How do I keep tenant A from seeing tenant B's rows?

Link

1 answer

Accepted answer
Accepted answer

Give that table a tenant_binding in column mode, inside its live block, mapping each Supero tenant name to its value in the source:

json
{
  "schema": "customer",
  "source": "public.customers",
  "mode": "live_read",
  "live": {
    "tenant_binding": {
      "mode": "column",
      "tenant_field": "org_id",
      "tenant_value_map": { "acme": "42", "globex": "77" },
      "on_unmapped_tenant": "deny"
    }
  }
}

Every read and write on the table is then filtered by org_id. A tenant with no entry in tenant_value_map is denied with a 403 rather than shown unfiltered rows; deny is the default.

Set this over the API with PUT /api/v1/connectors/{connector_id} and confirm it with a GET. The console wizard saves live tables with a fixed binding, which means the whole connector belongs to one tenant, so column mode is an API step.

Supero Integrations teamSupero team answered
Link

Your answer

One live Postgres table holds rows for several of our tenants | Supero Community