# Apache Superset

Acho can help you import data from spreadsheets or apps and host a database on our server, so you can export any type of data to Apache Superset. The process includes three steps:

1. [Generate database credentials](#generate-database-credentials)

   Each Acho's account generates **only** **one** set of credentials.
2. [Set up a connection in Apache Superset](#set-up-a-connection-in-apache-superset)

   Use the credentials generated from Step 1 to configure the connection in Apache Superset. The configuration only needs to be set up for the first time.
3. [Update tables in Apache Superset](#update-tables-in-apache-superset)

   Whenever you export a new table from Acho, you have to complete this step to add the table in Apache Superset.

## Generate database credentials

1\. Click the export button on the top right of the table.&#x20;

![](https://3574406564-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MB_fx7PCUqvFEdrucJC%2Fuploads%2FR3csO7z5TpjG6ONV3AEA%2Fimage.png?alt=media\&token=a9f70a98-d227-477a-8ab9-cdc880db18bc)

2\. Select **Apache Superset** and click **Export in Workflow**.

![](https://3574406564-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MB_fx7PCUqvFEdrucJC%2Fuploads%2FX19r58lXaWH5TNUcRlJY%2Fimage.png?alt=media\&token=86974161-6ff3-4c0f-ada3-6af4affd7bae)

3\. In Workflow, drag **Apache Superset** from the right sidebar to the canvas. Then, link it to the table that you want to export.

![](https://3574406564-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MB_fx7PCUqvFEdrucJC%2Fuploads%2FkcLzynJ3xDxWlXvUhxNf%2Fimage.png?alt=media\&token=66b04430-13e9-4596-91ff-cd9ac84a7348)

4\. Acho generates **Dataset ID** and a **JSON key file** automatically. Please use these credentials to [set up the connection](#set-up-a-connection-in-apache-superset) in Apache Superset.

![](https://3574406564-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MB_fx7PCUqvFEdrucJC%2Fuploads%2F4jgDzaImC8ARXY2AGuR6%2Fimage.png?alt=media\&token=2a7e0a89-61e7-443f-ac55-65b73333410b)

Note:

* Each Acho's account has a unique set of credentials for Apache Superset. &#x20;
* Every time you export data to Apache Superset, you can find the credentials. However, you **only need these credentials for the first time** to build the connection in Apache Superset.

## Set up a connection in Apache Superset

Superset requires a Python DB-API database driver and a SQLAlchemy dialect to be installed for BigQuery.

### 2-1. Install BigQuery driver

1\. Create `requirements-local.txt`

```git
# From the repo root...
touch ./docker/requirements-local.tx:
```

2\. Add the driver selected in the step above.

```
echo "pybigquery" >> ./docker/requirements-local.txt
```

3\. Rebuild your local image with the new driver baked in:

```
docker-compose build --force-rm
```

4\. After the rebuild of the Docker images is complete (which make take a few minutes) you can relaunch using the following command:

```
docker-compose up
```

The other option is to start Superset via Docker Compose is using the recipe in `docker-compose-non-dev.yml`, which will use pre-built frontend assets and skip the building of front-end assets:

```
docker-compose -f docker-compose-non-dev.yml up
```

### 2-2. Add a database&#x20;

1\. Open your Apache Superset and navigate to **Data > Databases**. Then, click the **+ DATABASE** button.navigate to **Data > Databases**. Then, click the **+ DATABASE** button.navigate to **Data > Databases**. Then, click the **+ DATABASE** button.

![](https://3574406564-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MB_fx7PCUqvFEdrucJC%2Fuploads%2F2mYLb6GHWGjZp5T9BXEi%2Fimage.png?alt=media\&token=ca8383f5-eb87-4f85-ad68-56b12e816129)

2\. Choose **Google BigQuery** under the dropdown of other databases

![](https://3574406564-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MB_fx7PCUqvFEdrucJC%2Fuploads%2FhwUpEYhJXAROeo6mAyC4%2Fimage.png?alt=media\&token=17547361-c37f-46f3-b563-0f19fb6071cb)

3\. Upload the JSON key file generated from [Step 1](#step-1-generate-database-credentials) and click **CONNECT**.

![](https://3574406564-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MB_fx7PCUqvFEdrucJC%2Fuploads%2FGr8UwTC1h0VGt0aPX4kJ%2Fimage.png?alt=media\&token=1877892a-934f-4229-b370-83cc6b09d5b3)

4\. Once the connection is set up, click **FINISH**.

![](https://3574406564-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MB_fx7PCUqvFEdrucJC%2Fuploads%2FeqTWeoEsqvfedoSf2VYr%2Fimage.png?alt=media\&token=0ea8c054-e6f3-41a9-a840-2850fb530667)

## Update tables in Apache Superset

1. Navigate to **Data > Datasets**. Then, click the **+ DATASET** button.

![](https://3574406564-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MB_fx7PCUqvFEdrucJC%2Fuploads%2FnDkOkx8c5QoI8kCp6afj%2Fimage.png?alt=media\&token=3588f367-e4da-409f-a884-afb8f73fd0ed)

2\. Specify the fields below:

* **`DATABASE`**: Choose the BigQuery database that you just connected in [Step 2](#set-up-a-connection-in-apache-superset).
* **`SCHEMA`**: Select **apache\_supset\_dataset\_XXX** (XXX is your unique account id on Acho.)
* **`SEE TABLE SCHEMA`**: Select a table that you want to import. You can see a list of tables that you already exported from Acho here.&#x20;

![](https://3574406564-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MB_fx7PCUqvFEdrucJC%2Fuploads%2Fl61RlXd4H9t79YNBM7BF%2Fimage.png?alt=media\&token=4e79a7be-c430-4fb7-b315-70bddec225f3)
