Skip to main content

DatasetML

Examples and reference documentation for datasets and visualisation.

Use the dataset YAML to create and format insights in your workspace as code.

Our dataset files are stored as YAML files, you can read more about the YAML format and its syntax here.


Example: analyze/datasets/tap-google-analytics/google_analytics_daily_users_last_14_days.yml

version: datasets/v0.2
source: Google Analytics
title: "Google Analytics Daily Users Last 14 Days"
questions: ‘How many users has there been over the last 14 days?
description: |-
Daily users over the last 14 days.

#google-analytics
metadata: |-
{
"name": "google_analytics_locations",
"label": "Daily Users",
"related_table": {
"columns": [
{"name": "report_date", "label": "Date", "description": "Date"}
],
"aggregates": [
{"name": "total_users", "label": "Total Users", "description": "Total Users"}
]
}
}
visualisation: |-
{"chartjs-chart": {"chartType": "bar"}}
query: |-
SELECT
report_date "google_analytics_locations.report_date"
, sum(users) "google_analytics_locations.total_users"
FROM google_analytics_locations
WHERE report_date >= current_date - interval '14' day
AND report_date < current_date
GROUP BY report_date
ORDER BY report_date

Key Information

PathJSON TypeDescription
versionstringThe version determines how the CLI handles publishing the dataset.
sourcestringA channel name to be used to group up related datasets in your workspace.
titlestringThe title at the top of the insight.
questionsstringQuestions that your dataset answers, so people can find the dataset just by asking questions.
descriptionstringInformation about what the dataset is, how it's being filtered or displayed and other relevant information. You can also add #tags.
metadatastring of JSONDetails about how the dataset's chart is laid out. More Info
visualisationstring of JSONDetails about the precise visualisation of the datasets chart. More Info
querystring of SQLThe query that returns the data from your datastore for use in the dataset's chart and related table. More Info
rawDatastring of a ListThe rawData key allows you to hard-code data directly into your dataset.

String Formatting

You may use any of the following string formats:

title: Google Analytics Daily Users Last 14 Days

title: 'Google Analytics Daily Users Last 14 Days'

title: "Google Analytics Daily Users Last 14 Days"

title: |-
Google Analytics Daily Users Last 14 Days
Multi-line string, remember to indent

The multiline string is generally the best way to display the string of JSON or SQL.


Further Reading: