Synchronize Superset datasets from Metriql datasets. The idea is to leverage Metriql datasets in your Superset workflow without any additional modeling in Superset.
The library is available in PyPI so you can install it via pip as follows:
pip install metriql-superset
The library expects stdin
for the metriql metadata and interacts with Superset via session tokens. Here is an example:
curl http://metriql-server.com/api/v0/metadata | metriql-superset --metriql-url http://metriql-server.com --superset-username USERNAME --superset-password PASSWORD sync-database
You can use --file
argument instead of reading the metadata from stdin
as an alternative.
Available commands are create-database
, list-databases
, sync-database
.
While Superset provides an API, it doesn't let updating / creating datasets and databases. Therefore, we create session token using internal APIs and interact with the internal APIs.
Yes! Preset offers an API in their Enterprise Plan and you can use the API tokens to be able to synchronize the metrics of Superset deployments in your Preset account. The token
in the picture below should be passed as --superset-username
and the value of secret
should be passed as --superset-password
:
Metriql requires you to run a separate service to be able to access the data in your data warehouse. In some cases, it might be overhead and we would love to get contributions from the community to make metriql-superset compatible with dbt metrics once they're released. However; here are the benefits of running Metriql as a separate service:
- Superset doesn't support JOIN relations in query builder since Metriql exposes all the fields including the ones that come from the relations as database columns, you will be able to unlock that feature in Superset.
- Metriql has Aggregates which speeds up OLAP queries by pre-aggregating the fact tables. It re-writes the queries Superset runs on Metriql before executing them in your data warehouse.
- Metriql has an advanced semantic layer that lets you create filtered measures, non-additive and window measures which are not available in Superset. Additionally, you can use Jinja expressions in your metrics/dimensions.
- Superset has timeframes to some extent but Metriql offers a set of different timeframes that lets you analyze the data in different granularities.
- It's not possible to access the metrics created in Superset from a different BI tool / SQL client but Metriql lets you access your metrics from different data tools.