SQL Interface
Intro
It is possible to query Honeydew semantic model via a BI tool or a SQL editor.
Anything that support JDBC can connect to Honeydew.
A sample query looks like:
SELECT
"orders.o_orderdate",
AGG("lineitem.revenue")
FROM honeydew.world
WHERE "customer.c_mktsegment" = 'MACHINERY'
HAVING AGG("orders.count") < 10
GROUP BY 1
ORDER BY 1 DESC
LIMIT 30
This would the last month daily revenue of machinery customers.
The world as one big flat table
The world
is a virtual table that includes as columns every attribute of every entity that is exposed to the SQL interface.
Building the correct JOIN logic happens behind the scenes when world
is queried.
world
is the whole semantic model. If want to use the SQL interace on a subset of the world, for performance or access control reasons,
can instead use the SQL interface on a dynamic dataset
Interface
The AGG special function
Any regular aggregation (like a SUM
or a COUNT
) can be used.
However, to use named aggregations (metrics) in Honeydew, use the AGG
function. It behaves as standard aggregation functions.
Filtering order
When using world
to access the whole semantic model:
- Source table filters - defined as part of entity source table
- Filters of filtered metrics used in calculated attributes used in the SQL query
- Filters in the SQL query (
WHERE
andHAVING
) - Filters of filtered metrics used in the SQL query
When using a dynamic dataset to access with SQL a controlled subset of world
, the filters given in the SQL interface are merged with
the filters of the dynamic dataset. See fill filtering order here
Was this page helpful?