/
How to Query a Data Source Directly
How to Query a Data Source Directly
It is possible to query data straight from a Data Source, instead of loading it into a Datamart and querying from there. This can save unnecessary processing of loading from Data Source to Datamart.
Refer to the following API links for more in-depth info:
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)
Related content
Query a Datamart
Query a Datamart
More like this
Get Datamart Time Dimension from a Date
Get Datamart Time Dimension from a Date
Read with this
Can I query a Data Source directly?
Can I query a Data Source directly?
More like this
Configure Product Data Source
Configure Product Data Source
Read with this
How do I get data from the Analytics module in the logic?
How do I get data from the Analytics module in the logic?
More like this
Configure Business Calendar
Configure Business Calendar
Read with this
Found an issue in documentation? Write to us.