SQL Interface
How to query semantics in SQL via JDBC
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:
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 domain.
Domains in SQL interface
Domains in the JDBC interface present in a similar way to world
: every domain is a flat table.
All the domains are in the domains
schema:
Parameters in the SQL interface
It is possible to set values for parameters through the SQL interface. See parameters for more info.
Branches in the SQL interface
When connecting to the SQL interface, add __branch_name
to the catalog name to connect to a development branch with the name branch_name
.
For example, when the workspace is called tpch_demo
and has a production branch and a development branch called dev
,
the corresponding JDBC catalogs would be called tpch_demo
and tpch_demo__dev
.
Interface
Attributes
Attributes are exposed as columns in the virtual table.
Any expression can be used on attributes, including aggregations (like a SUM
or a COUNT
) can be used.
Metrics
Metrics are exposed as columns in the virtual table.
When using an aggregation function (like SUM
) on a metric column the function is ignored,
and the actual metric computation runs instead.
AGG
is special function that when run on a metric, directly invokes its computation.
For clarity of SQL, prefer using the AGG
function to get metric value, as in the example above.
Filtering and Computation Order
When using SQL interface, the filters provided by the SQL query (with WHERE
and with HAVING
) are applied.
For more details, see order of computation
You can filter on attributes using WHERE
and on metrics using HAVING
Was this page helpful?