It is possible to query data straight from a data sourceData Source, instead of loading it into a Datamart and querying from there. This can save unnecessary processing of loading from DS Data Source to DMDatamart.
Refer to the following API links for more in-depth info:
paste-code-macro | ||||
---|---|---|---|---|
| ||||
def dmCtx = api.getDatamartContext() def salesDS = dmCtx.getDataSource("SalesHistory2") def dsQuery = dmCtx.newQuery(salesDS) def filters = [ Filter.equal("Sku", api.product("sku")), ] dsQuery.select("SUM(Revenue)", "revenue") dsQuery.select("SUM(UnitsSold)", "unitsSold") dsQuery.select("YearMonth", "month") dsQuery.where(filters) def result = dmCtx.executeQuery(dsQuery) |