function queryForTestSamples()

in src/server/selection/banditData.ts [48:62]


function queryForTestSamples(testName: string, channel: Channel, sampleCount?: number) {
    const docClient = new AWS.DynamoDB.DocumentClient({ region: 'eu-west-1' });
    return docClient
        .query({
            TableName: `support-bandit-${isProd ? 'PROD' : 'CODE'}`,
            KeyConditionExpression: 'testName = :testName',
            ExpressionAttributeValues: {
                // In the bandit data table we prefix the testName with the channel
                ':testName': `${channel}_${testName}`,
            },
            ScanIndexForward: false, // newest first
            ...(sampleCount ? { Limit: sampleCount } : {}),
        })
        .promise();
}