async function start()

in packages/azure-kusto-data/example.js [17:49]


async function start() {
    try {
        const results = await kustoClient.execute(database, `['${table}'] | limit 1`);
        console.log(JSON.stringify(results));
        console.log(results.primaryResults[0].toString());
    } catch (error) {
        console.log(error);
    }

    // providing ClientRequestProperties
    // for a complete list of ClientRequestProperties
    // go to https://docs.microsoft.com/en-us/azure/kusto/api/netfx/request-properties#list-of-clientrequestproperties
    let clientRequestProps = new ClientRequestProperties();
    const oneMinute = 1000 * 60;
    clientRequestProps.setTimeout(oneMinute);

    // having client code provide its own clientRequestId is
    // highly recommended. It not only allows the caller to
    // cancel the query, but also makes it possible for the Kusto
    // team to investigate query failures end-to-end:
    clientRequestProps.clientRequestId = `MyApp.MyActivity;${uuidv4()}`;

    try {
        // `execute()` infers the type of command from the query, although you can also specify the type explicitly using the methods `excuteQuery()`,`executeQueryV1()` or `executeMgmt()`
        const results = await kustoClient.execute(database, `['${table}'] | limit 1`, clientRequestProps);
        console.log(JSON.stringify(results));
        console.log(results.primaryResults[0].toString());
    } catch (error) {
        console.log(error);
    }

    kustoClient.close();
}