# Metabase

Metabase is a popular open-source visualization tool, but it only supports importing data from databases, such as MySQL, BigQeury, etc. 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 Metabase. 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 Metabase](#set-up-a-connection-in-metabase)

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

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

{% embed url="<https://www.youtube.com/embed/WxxNMv-UDf8>" %}

## 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 **Metabase** and click **Export to Workflow**.

![](https://3574406564-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MB_fx7PCUqvFEdrucJC%2Fuploads%2FpkeeEkXZRLV2kScCJznD%2Fimage.png?alt=media\&token=370e5496-0cea-4136-bf73-54ac4108c76c)

3\. In Workflow, drag **Metabase** 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%2FPl3StKd2pirJuzBtrbOW%2Fimage.png?alt=media\&token=41f229a7-7485-453a-a8fb-eceecad82905)

3\. Acho generates **Dataset ID** and a **JSON key file** automatically. Please use these credentials to [set up the connection](#set-up-a-connection-in-metabase) in Metabase.

![](https://3574406564-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MB_fx7PCUqvFEdrucJC%2Fuploads%2FKyFmPoRl5j5cR8KLhVyA%2Fimage.png?alt=media\&token=b002de54-6ea2-4868-bccd-9358b7ed15fc)

Note that:

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

## Set up a connection in Metabase

1. Open your Metabase and click **Admin** on the top-right gear icon

![](https://3574406564-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MB_fx7PCUqvFEdrucJC%2F-MVY4cYaCBqBdgLdISFq%2F-MVY65b_ndbTN2l4Kjta%2Fadmin.jpg?alt=media\&token=12c31586-19cf-4728-81e3-99513643e265)

2\. Navigate to **Settings** > **Setup** and click **Add a database**.

![](https://3574406564-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MB_fx7PCUqvFEdrucJC%2F-MVY7-MiAWtyrnaKAgSd%2F-MVY7NkpTwihZXO3nF2P%2Fadd%20a%20db.jpg?alt=media\&token=df7eb5cc-9af8-4bb2-8d00-698c65054a0a)

3\. Follow the instructions below to complete the configuration.

* **`Database type`**: Choose **BigQuery**.
* **`Name`**: The name of the database in your Metabase.
* **`Dataset ID`**: The Dataset ID you receive from [Step 1](#step-1-generate-database-credentials).
* **`Service account JSON file`**: The JSON file you receive from [Step 1](#step-1-generate-database-credentials).
* (Optional) If you need to customize when Metabase should sync with Acho, please turn on the button, **This is a large database, so let me choose when Metabase syncs and scans**.

![](https://3574406564-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MB_fx7PCUqvFEdrucJC%2F-MVYS48zJNQjNqICcZeB%2F-MVYSLWf2p4J8veYv9lB%2Ffill%20in%20form.jpg?alt=media\&token=4a984cb2-313a-415f-8f78-7cf218ec68d1)

You may see a different form if you are using the latest version of Metabase:

1. **`Service account JSON file`**: The JSON file you receive from [Step 1](#step-1-generate-database-credentials).
2. **`Datasets`**: Change "Only these..." and put the Dataset ID you receive from [Step 1](#step-1-generate-database-credentials) there.

![](https://3574406564-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MB_fx7PCUqvFEdrucJC%2Fuploads%2FvdGBUbGofzufM9gmu47l%2Fimage.png?alt=media\&token=9833abc0-068a-4126-8bd0-b2750c0c08de)

4\. Click **Save** and the connected database will show up on the homepage.

If this is your first time connecting a database, you might encounter a **timeout error** when you save. This issue can be fixed by **changing your Metabase connection timeout variable**. Visit the Metabase documentation [here](https://www.metabase.com/docs/latest/configuring-metabase/environment-variables) to see how to change environmental variables based on how you're running Metabase (JAR File or Docker).

This is the variable to change and what it should be changed to: **`MB_DB_CONNECTION_TIMEOUT_MS=120000`**

![](https://3574406564-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MB_fx7PCUqvFEdrucJC%2F-MVYBxk0lqNMu8TtDkva%2F-MVYC20kYa1xJloxfMs-%2FAcho%20database.jpg?alt=media\&token=55d6d0b2-b213-479a-8d3d-c9f5ef01b8a7)

## Update tables in Metabase

If you apply some actions to change your table, you can follow the steps below to sync your table to Metabase. (Note: if you already turn on Data Sync for your table, the changes will be sent to Metabase when Data Sync runs)

1\. Go to workflow and click the edge between the table and Metabase. Then, click **Run**.

![](https://3574406564-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MB_fx7PCUqvFEdrucJC%2Fuploads%2F9FmtjgblDZ4p8DR8MDr5%2Fimage.png?alt=media\&token=fc2640c9-c68e-4d4b-bd43-a482a15f1517)

2\. Go to Metabase, and click **Admin** on the top-right gear icon.

![](https://3574406564-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MB_fx7PCUqvFEdrucJC%2F-MVYCRoFE30YVchBbnVm%2F-MVYDdfE0Q3r34KR9zhB%2Fadmin.jpg?alt=media\&token=d6777167-4cf6-4f8b-98f8-26863bbbca9e)

3\. Navigate to **Databases** and click the Database Name you created during the setup of the database.

![](https://3574406564-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MB_fx7PCUqvFEdrucJC%2F-MVYCRoFE30YVchBbnVm%2F-MVYFn0mYx60tmfAiQyd%2Fclick%20the%20db%20name.jpg?alt=media\&token=db709752-f90a-4602-8f8b-f62e1f63ad1d)

4\. Click **Sync database schema now** to retrieve the tables from Acho

![](https://3574406564-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MB_fx7PCUqvFEdrucJC%2F-MVYGIL9JUKD4lUZqe_a%2F-MVYGpnUo2IZBT989Wql%2Fsync%20the%20db.jpg?alt=media\&token=a4aed9f8-d4aa-4361-aabc-8cb205d0295d)

5\. Click the gear icon on the top right, and click **Exit admin**.

![](https://3574406564-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MB_fx7PCUqvFEdrucJC%2F-MVYGIL9JUKD4lUZqe_a%2F-MVYIApf1lnrTx4u1DhL%2Fexit%20admin.jpg?alt=media\&token=5b76868f-1993-4cf3-a751-e50d23b421ba)

6\. Click the Database Name again

![](https://3574406564-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MB_fx7PCUqvFEdrucJC%2F-MVYIGXu0Wus5hHbw0Rt%2F-MVYIY9WJfqwdCqPF9GB%2FAcho%20database.jpg?alt=media\&token=d993e479-454f-4618-b1cf-fae99d505c49)

7\. The exported Acho table will show up in your Metabase now.

![](https://3574406564-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MB_fx7PCUqvFEdrucJC%2F-MVYJlT4N9sddrmCrCcE%2F-MVYME6ZxiLIqOD1BmGv%2FScreen%20Shot%202021-03-11%20at%205.13.53%20PM.png?alt=media\&token=99e7e4cb-8e99-45fa-8057-f51b814b92e6)

## How to delete the connected database or an Acho table in Metabase

### Deleting an Acho table in Metabase

&#x20;1\. Delete the table on Acho

![](https://3574406564-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MB_fx7PCUqvFEdrucJC%2F-MVYJlT4N9sddrmCrCcE%2F-MVYN-nOdit1lTgOMR6b%2FScreen%20Shot%202021-03-11%20at%205.19.49%20PM.png?alt=media\&token=778d17bd-e52f-49c1-a345-c10afcfe520b)

2\. Click "Sync database schema now" again

3\. The table in the Metabase database will automatically be deleted

### Deleting the whole database in Metabase

1\. Go to Setting (top-right gear) > Admin > Database > Your Acho Database Name

2\. Click "Remove this database"

![](https://3574406564-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MB_fx7PCUqvFEdrucJC%2F-MVYJlT4N9sddrmCrCcE%2F-MVYO_bmetsfIqTmF9pj%2Fremove%20db.jpg?alt=media\&token=03532099-acd3-43cc-af01-9fa13f95272d)
