# Superset

## Start Superset with Docker Image

Start running [Superset Image](https://hub.docker.com/repository/docker/apachepinot/pinot-superset) with pre-built Superset Pinot connector.

{% tabs %}
{% tab title="Docker" %}
1\. Run below command to start a standalone Superset deployment

```
docker run \
  --network pinot-demo \
  --name=superset \
  -p 8088:8088 \
  -d apachepinot/pinot-superset:latest
```

2.1. (First time) Setup Admin account by running below command and follow instructions to set password.

```
docker exec -it superset superset fab create-admin \
               --username admin \
               --firstname Superset \
               --lastname Admin \
               --email admin@superset.com \
               --password admin
```

2.2. (First time) DB upgrade and Initialize Superset

```
docker exec -it superset superset db upgrade
docker exec -it superset superset init
```

3\. Import Pre-defined Pinot Datasources and Dashboard

```
docker exec \
    -t superset \
    bash -c 'superset import_datasources -p /etc/examples/pinot/pinot_example_datasource_quickstart.yaml && \
             superset import_dashboards -p /etc/examples/pinot/pinot_example_dashboard.json'
```

4\. Go to SuperSet UI: <http://localhost:8088/> to play around with dashboard.
{% endtab %}
{% endtabs %}

## Advanced Setup

### Adding Pinot Database

In order to add Pinot cluster as a database, a SQLAlchemy URI is required.

The format of URI is:

`pinot://<pinot-broker-host>:<pinot-broker-port><pinot-broker-path>?controller=<pinot-controller-host>:<pinot-controller-port>`

E.g.

> `pinot://pinot-broker:8099/query/sql?controller=http://pinot-controller:9000/`

Below is an example for the QuickStart cluster, you can click `TEST CONNECTION` button to check if Pinot cluster is successfully connected.

![Add Pinot cluster as a new Database](https://1662808032-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LtH6nl58DdnZnelPdTc%2F-MGFrg5Pwddqv18QuU2V%2F-MGFwPB50n1XXnuLA1M3%2Fimage.png?alt=media\&token=606bf1ec-407e-46d4-8c78-d165fced331b)

### Adding Pinot Table

User can add an existing table into Superset:

![Add Table Definition](https://1662808032-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LtH6nl58DdnZnelPdTc%2F-MGFyvyOXHyuXaJ_mkrN%2F-MGFzppclzuySrtCCaKK%2Fimage.png?alt=media\&token=1f0dd477-456e-4f56-8127-30fb977728ca)

![Table Definition](https://1662808032-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LtH6nl58DdnZnelPdTc%2F-MGFyvyOXHyuXaJ_mkrN%2F-MGG-IwXjeprgMN4DHHv%2Fimage.png?alt=media\&token=a8e86c83-af31-4238-8ac2-287df6dc2bd5)

User can edit table/column definition by clicking the `edit` button left to the table name.

### Configuring time column

User can configure an existing column `mergedTimeMillis` as temporal and set `Datetime Format` accordingly.

![Configure time column](https://1662808032-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LtH6nl58DdnZnelPdTc%2F-MGFyvyOXHyuXaJ_mkrN%2F-MGG0xLZRQOY2awTV9Os%2Fimage.png?alt=media\&token=63b82129-f57c-4e09-8234-c05a99e0c0ce)

### Adding a derived column

User can also add a new column by setting the expression.

![Add a simple derived column](https://1662808032-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LtH6nl58DdnZnelPdTc%2F-MGFyvyOXHyuXaJ_mkrN%2F-MGG1Tj-Qv3uFunrZ-5U%2Fimage.png?alt=media\&token=7f601869-b9bc-4cb1-894b-b57b80ea0aab)

Another example:

![Add a derived column with Pinot UDFs](https://1662808032-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LtH6nl58DdnZnelPdTc%2F-MGFyvyOXHyuXaJ_mkrN%2F-MGG1zRg_l60z3fC_36u%2Fimage.png?alt=media\&token=0b543ebe-fceb-4266-8dd0-59247dd01efb)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.pinot.apache.org/release-0.12.1/integrations/superset.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
