Skip to Content

Tenancy

Set tenancy on a datasource

Tell Databrain which table identifies your customers, so embedded queries return each customer's own rows.

Before you start

  • You are an Admin or a Developer, or your role has the datasource Edit Tenancy Level permission. Editors and Viewers do not have it.
  • The datasource is connected and synced. The customer table must be in its schema.
  • You know your tenancy model.

Steps

  1. Go to Data Studio > Datasources.

  2. In the datasource’s row, select the shield icon (Add tenancy or Edit tenancy). You can also open the datasource and select the Tenancy tab.

    Datasources list row for Subscription orders with the Add tenancy shield icon highlighted in Actions.
    The row actions show when you point at a datasource. The shield is Add tenancy.
  3. Under How is customer data separated?, select Table, Database or Multi-database.

    Tenant isolation card, Not configured, with the Table option highlighted next to Database.
    Pick the shape your warehouse already has.
  4. For Table, fill in Which table identifies a customer?:

    • Customer table: the table with one row per customer, for example public.customers.
    • Primary key column: the column that identifies a customer, for example id.
    • Primary key type: number or string. Databrain reads it from the warehouse. Change it only if it is wrong.
    • Customer name column: the column with the customer’s name, for example company_name.
    Which table identifies a customer? section with Customer table highlighted, and Primary key column, Primary key type and Customer name column filled in.
    Pick the table that has one row per customer, then its key and name columns.
  5. For Database or Multi-database, check the list under Databases and schemas we can see. Each one is treated as a separate customer.

  6. Select Save tenancy.

    Bottom of the tenancy form with You have unsaved changes, Discard, and the Save tenancy button highlighted.
    Save tenancy is in the bar under the form. Discard throws the changes away.
  7. Read the dialog and select Save tenancy again.

Datasource Tenancy tab with Tenant isolation Not configured, Table and Database options, and Customer table, Primary key column, Primary key type and Customer name column fields
The Tenancy tab of a datasource with Table selected. The panel on the right explains each choice.

You see Datasource tenancy settings saved, and the Tenant isolation badge changes from Not configured to Configured. The Tenancy column on the Datasources list shows the level.

Saving tenancy removes the default client from every data app embed in your company, not only the ones on this datasource. An embed with no default client waits for your page to pass a client ID. Set a client on each embed that relied on the default.

Save tenancy and clear the default client dialog with Cancel and Save tenancy buttons
The confirmation dialog explains what changes when you save.

With Database, Databrain lists the databases and schemas it found on the connection:

Datasource Tenancy tab with Database selected and the list Databases and schemas we can see
Database tenancy lists the schemas Databrain can see. Each one is a customer.

A datamart’s own tenancy wins over this setting. Next, set tenancy on the datamart.

If something goes wrong

  • The Tenancy tab is greyed out. Your role cannot change tenant isolation. Ask an Admin.
  • Pick a customer table, a primary key column and a customer name column before saving. Fill in all three fields.
  • No tables in this datasource’s schema cache. Sync the datasource, then come back.
  • Nothing discovered yet. Databrain has not read any databases from this connection. Sync it, then come back.

On this page