UNPKG

azure-kusto-ingest

Version:
33 lines 1.56 kB
// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. import { BlobDescriptor } from "./descriptors.js"; import { AbstractKustoClient } from "./abstractKustoClient.js"; import { Client as KustoClient, KustoConnectionStringBuilder } from "azure-kusto-data"; export class KustoStreamingIngestClientBase extends AbstractKustoClient { constructor(kcsb, defaultProps, autoCorrectEndpoint = true) { super(defaultProps); if (typeof kcsb === "string") { kcsb = new KustoConnectionStringBuilder(kcsb); } if (autoCorrectEndpoint) { kcsb.dataSource = this.getQueryEndpoint(kcsb.dataSource); } this.kustoClient = new KustoClient(kcsb); this.defaultDatabase = this.kustoClient.defaultDatabase; } async ingestFromBlob(blob, ingestionProperties, clientRequestId) { var _a; const props = this._getMergedProps(ingestionProperties); const descriptor = blob instanceof BlobDescriptor ? blob : new BlobDescriptor(blob); // No need to check blob size if it was given to us that it's not empty await descriptor.fillSize(); return await this.kustoClient.executeStreamingIngest(props.database, props.table, undefined, props.format, (_a = props.ingestionMappingReference) !== null && _a !== void 0 ? _a : null, descriptor.path, clientRequestId); } close() { if (!this._isClosed) { this.kustoClient.close(); } super.close(); } } //# sourceMappingURL=streamingIngestClientBase.js.map