Malloy Documentation

DuckDB can be used to query a JSON API endpoint, and Malloy makes it simple to transform the resulting data. The example below reads exchange rate data from the US Treasury and shows the data by currency over time.

-- source: exchange_rates is 
--   duckdb.table(',exchange_rate,record_date&page[size]=10000&filter=country_currency_desc.json')

Query by Country

This query builds a line chart showing exchange rate values over time. With a simple Malloy query, we can easily transform and analyze a dataset directly from an HTTP API, without any intermediate database required.

-- #(docs) limit=5000 size=large
-- run: exchange_rates -> {
--   group_by: data.country_currency_desc
--   # line_chart
--   nest: by_date is  {
--     group_by: 
--       data.record_date
--       rate is data.exchange_rate::number
--   }
-- }