Can I query a Data Source directly?

Question

Does anyone know of a way to query data straight out of a Data Source from a calculation logic instead of setting up a Datamart + Data Load for it?

I found that I can use the search API to find the DS, but it contains no actual data, only the structure:

api.find("DMDS", Filter.equal("uniqueName", "DSNAME"))

Answer

You need to use DatamartContext.getDataSource(String name).

def dmCtx = api.getDatamartContext()