Skip to content

Commit 36502f6

Browse files
authored
DATA-3757 Update TabularDataByMQL to have optional bool for use_recent_data (#466)
1 parent 90561f9 commit 36502f6

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

src/app/data-client.spec.ts

+11
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,17 @@ describe('DataClient tests', () => {
255255
expect(result[0]?.key1).toBeInstanceOf(Date);
256256
expect(promise).toEqual(data);
257257
});
258+
259+
it('get tabular data from MQL with useRecentData = true', async () => {
260+
const promise = await subject().tabularDataByMQL(
261+
'some_org_id',
262+
[{ query: 'some_mql_query' }],
263+
true
264+
);
265+
const result = promise as typeof data;
266+
expect(result[0]?.key1).toBeInstanceOf(Date);
267+
expect(promise).toEqual(data);
268+
});
258269
});
259270

260271
describe('tabularDataByFilter tests', () => {

src/app/data-client.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -153,11 +153,14 @@ export class DataClient {
153153
*
154154
* @param organizationId The ID of the organization that owns the data
155155
* @param query The MQL query to run as a list of BSON documents
156+
* @param useRecentData Whether to query blob storage or your recent data
157+
* store. Defaults to false
156158
* @returns An array of data objects
157159
*/
158160
async tabularDataByMQL(
159161
organizationId: string,
160-
query: Uint8Array[] | Record<string, Date | JsonValue>[]
162+
query: Uint8Array[] | Record<string, Date | JsonValue>[],
163+
useRecentData?: boolean
161164
) {
162165
const binary: Uint8Array[] =
163166
query[0] instanceof Uint8Array
@@ -166,6 +169,7 @@ export class DataClient {
166169
const resp = await this.dataClient.tabularDataByMQL({
167170
organizationId,
168171
mqlBinary: binary,
172+
useRecentData,
169173
});
170174
return resp.rawData.map((value) => BSON.deserialize(value));
171175
}

0 commit comments

Comments
 (0)