---
description: This guide describes how to configure Explo to support multiple data sources
---

# Multiple Data Sources

## Why Multiple Data Sources?

There are a few different reasons why you may want to connect multiple data sources to Explo:

* You want to connect and build dashboards against both your staging and production databases
* You have customer data segmented into multiple different databases

In either of these scenarios, you can use Explo to connect multiple data sources to power your dashboards.&#x20;

{% hint style="info" %}
Explo allows you to folder your data sources by schema to configure which queries run against which data sources. For more information, navigate to the [Managing Schema section](managing-schema) of our documentation.
{% endhint %}

## View Data Sources

To view all connected data sources, navigate to the Data tab.

![](https://2280154036-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MQY7AWezpSx_iDLogun%2Fuploads%2FXuWBQvhuBLr218Ph7lL5%2Fimage.png?alt=media\&token=1a35fa08-f9bd-4a54-ad80-22482bed6369)

On this page, you will see all connected data sources. If you click on a specific data source, you will be taken to a data viewer where you can preview the data in the data source. This view also allows you to toggle between different data sources within that schema.

![](https://2280154036-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MQY7AWezpSx_iDLogun%2F-MaANLB-0YhK1RmhmcWG%2F-MaATQRj33LgEyQKV1g4%2FScreen%20Shot%202021-05-20%20at%204.22.32%20PM.png?alt=media\&token=3748f43f-5a58-4893-9f8c-e043d21c88b6)

## Add a Data Source

On the Data tab, click the "Add Data Source" button to add a new data source. First, you'll be prompted to enter a display nickname and id for your database, along with choosing its schema and access group. For more information about access groups, check out [this section of our documentation.](../../managing-permissions/access-groups)

![](https://2280154036-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MQY7AWezpSx_iDLogun%2Fuploads%2Fu3KsjK12b88rlHzlqyt6%2Fimage.png?alt=media\&token=d076a66b-dd72-4e2f-bab1-d9ba36656a4e)

Follow the steps in the flow and enter your credentials for the database to connect it to Explo.&#x20;

## Connecting User Groups to Data Sources

### End User Group API

Every user group you create in Explo is associated with a specific set of data sources, one for each schema. When you render the dashboard for that user group, it will pull all data for that view from those data sources associated with the user group.

When you create a user group via the API, you can optionally specify a `data_source_id` or the `data_source_provided_id`. This will associate the user group with that data source for the schema that data source belongs to. If you do not specify the data source, it will associate the user group with the default data source, which you can configure from the data page.

For more information, go to [our section on the End User Group API](../../end-user-group-api)

{% hint style="info" %}
You can retrieve the data default `data_source_id` by going to the data tab and looking at the number ID for the data source (47)
{% endhint %}

![Example data sources with IDs](https://2280154036-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MQY7AWezpSx_iDLogun%2Fuploads%2F5GOTUL2m1OPTgoPzQim8%2Fimage.png?alt=media\&token=4ab2b788-4d44-4519-a828-d7b7d60e8661)

{% hint style="info" %}
You can assign a `data_source_provided_id` in the data tab which then can be used to identify the data source in your API requests:
{% endhint %}

![Selecting to rename the provided\_id](https://2280154036-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MQY7AWezpSx_iDLogun%2Fuploads%2FOStyH0m8qXcqS4WadXys%2Fimage.png?alt=media\&token=323b3516-d5d4-428a-87bf-d10f6df694f9)

### Customers Tab

On the Customers tab, there are dropdowns for choosing a data source for each schema when editing or creating a customer. If no data source is selected for a given schema, that customer will be associated with the default data source for that access group and schema.

![](https://2280154036-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MQY7AWezpSx_iDLogun%2Fuploads%2FLx2VmYmFZgrkccUqCl7h%2Fimage.png?alt=media\&token=6c67ac47-0563-4131-90fc-65cd1d310f3e)

## Viewing Dashboards in Different Data Sources

When you are making dashboards, there is a dropdown for user groups.

![](https://2280154036-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MQY7AWezpSx_iDLogun%2F-MaANLB-0YhK1RmhmcWG%2F-MaAULzuqQU9iS8kY-1s%2FScreen%20Shot%202021-05-20%20at%204.35.16%20PM.png?alt=media\&token=8b4eb170-64bf-4cb2-8224-9aa328ff8856)

For each dashboard, you will be able to toggle between different user groups to select which one you are viewing as. the data on the page will then reflect data from the data sources associated with that user group.

## Embedding with Multiple Data Sources

Embedding with multiple data sources is as straightforward as with a single data source.&#x20;

When you create your user groups, we will give you back the user group token. Simply provide this token when embedding and we will query from the right data sources and present the correct data.
