Kusto.Ingest 客户端接口和类Kusto.Ingest client interfaces and classes
Kusto.Ingest 库中的主要接口和类包括:The main interfaces and classes in the Kusto.Ingest library are:
- 接口 IKustoIngestClient:主引入接口。interface IKustoIngestClient: The main ingestion interface.
- 类 ExtendedKustoIngestClient:主引入接口的扩展。Class ExtendedKustoIngestClient: Extensions to the main ingestion interface.
- 类 KustoIngestFactory:引入客户端的主工厂。class KustoIngestFactory: The main factory for ingestion clients.
- 类 KustoIngestionProperties:用于提供常见引入属性的类。class KustoIngestionProperties: Class used to provide common ingestion properties.
- 类 IngestionMapping:用于描述引入的数据映射的类。class IngestionMapping: Class used to describe the data mapping for the ingestion.
- 枚举 DataSourceFormat:支持的数据源格式(例如,CSV、JSON)Enum DataSourceFormat: Supported data source formats (for example, CSV, JSON)
- 接口 IKustoQueuedIngestClient:一个接口,描述仅适用于排队引入的操作。Interface IKustoQueuedIngestClient: Interface describing operations that apply for queued ingestion only.
- 类 KustoQueuedIngestionProperties:仅适用于排队引入的属性。Class KustoQueuedIngestionProperties: Properties that apply to queued ingestion only.
接口 IKustoIngestClientInterface IKustoIngestClient
- IngestFromDataReaderAsyncIngestFromDataReaderAsync
- IngestFromStorageAsyncIngestFromStorageAsync
- IngestFromStreamAsyncIngestFromStreamAsync
public interface IKustoIngestClient : IDisposable
{
/// <summary>
/// Ingests data from <see cref="IDataReader"/>. <paramref name="dataReader"/> will be closed when the call completes.
/// </summary>
/// <param name="dataReader">The <see cref="IDataReader"/> data source to ingest. Only the first record set will be used</param>
/// <param name="ingestionProperties">Additional properties to be used during the ingestion process</param>
/// <param name="sourceOptions">Options for the <see cref="IDataReader"/> ingestion source. This is an optional parameter</param>
/// <returns>An <see cref="IKustoIngestionResult"/> task</returns>
Task<IKustoIngestionResult> IngestFromDataReaderAsync(IDataReader dataReader, KustoIngestionProperties ingestionProperties, DataReaderSourceOptions sourceOptions = null);
/// <summary>
/// Ingest data from one of the supported storage providers. Currently the supported providers are: File System, Azure Blob Storage.
/// </summary>
/// <param name="uri">The URI of the storage resource to be ingested. Note: This URI may include a storage account key or shared access signature (SAS).
/// See <see href="https://docs.azure.cn/kusto/api/connection-strings/storage"/> for the URI format options.</param>
/// <param name="ingestionProperties">Additional properties to be used during the ingestion process</param>
/// <param name="sourceOptions">Options for the storage ingestion source. This is an optional parameter</param>
/// <returns>An <see cref="IKustoIngestionResult"/> task</returns>
Task<IKustoIngestionResult> IngestFromStorageAsync(string uri, KustoIngestionProperties ingestionProperties, StorageSourceOptions sourceOptions = null);
/// <summary>
/// Ingest data from <see cref="Stream"/>.
/// </summary>
/// <param name="stream">The <see cref="Stream"/> data source to ingest</param>
/// <param name="ingestionProperties">Additional properties to be used during the ingestion process</param>
/// <param name="sourceOptions">Options for the <see cref="Stream"/> ingestion source. This is an optional parameter</param>
/// <returns>An <see cref="IKustoIngestionResult"/> task</returns>
Task<IKustoIngestionResult> IngestFromStreamAsync(Stream stream, KustoIngestionProperties ingestionProperties, StreamSourceOptions sourceOptions = null);
}
类 ExtendedKustoIngestClientClass ExtendedKustoIngestClient
- IngestFromSingleBlob - 已弃用。IngestFromSingleBlob - Deprecated. 请改用
IKustoIngestClient.IngestFromStorageAsync
。UseIKustoIngestClient.IngestFromStorageAsync
instead. - IngestFromSingleBlobAsync - 已弃用。IngestFromSingleBlobAsync - Deprecated. 请改用
IKustoIngestClient.IngestFromStorageAsync
。UseIKustoIngestClient.IngestFromStorageAsync
instead. - IngestFromDataReader - 已弃用。IngestFromDataReader - Deprecated. 请改用
IKustoIngestClient.IngestFromDataReaderAsync
。UseIKustoIngestClient.IngestFromDataReaderAsync
instead. - IngestFromDataReaderAsyncIngestFromDataReaderAsync
- IngestFromSingleFile - 已弃用。IngestFromSingleFile - Deprecated. 请改用
IKustoIngestClient.IngestFromStorageAsync
。UseIKustoIngestClient.IngestFromStorageAsync
instead. - IngestFromSingleFileAsync - 已弃用。IngestFromSingleFileAsync - Deprecated. 请改用
IKustoIngestClient.IngestFromStorageAsync
。UseIKustoIngestClient.IngestFromStorageAsync
instead. - IngestFromStream - 已弃用。IngestFromStream - Deprecated. 请改用
IKustoIngestClient.IngestFromStreamAsync
。UseIKustoIngestClient.IngestFromStreamAsync
instead. - IngestFromStreamAsyncIngestFromStreamAsync
public static class ExtendedKustoIngestClient
{
/// <summary>
/// Ingest data from a single data blob
/// </summary>
/// <param name="client">The ingest client that will execute the ingestions</param>
/// <param name="blobUri">The URI of the blob will be ingested</param>
/// <param name="deleteSourceOnSuccess">Indicates if the source blob should be deleted after a successful ingestion</param>
/// <param name="ingestionProperties">Additional properties to be used during the ingestion process</param>
/// <param name="rawDataSize">The uncompressed raw data size</param>
/// <returns><see cref="IKustoIngestionResult"/></returns>
public static IKustoIngestionResult IngestFromSingleBlob(this IKustoIngestClient client, string blobUri, bool deleteSourceOnSuccess, KustoIngestionProperties ingestionProperties, long? rawDataSize = null);
/// <summary>
/// Ingest data from a single data blob asynchronously
/// </summary>
/// <param name="client">The ingest client that will execute the ingestions</param>
/// <param name="blobUri">The URI of the blob will be ingested</param>
/// <param name="deleteSourceOnSuccess">Indicates if the source blob should be deleted after a successful ingestion</param>
/// <param name="ingestionProperties">Additional properties to be used during the ingestion process</param>
/// <param name="rawDataSize">The uncompressed raw data size</param>
/// <returns>An <see cref="IKustoIngestionResult"/> task</returns>
public static Task<IKustoIngestionResult> IngestFromSingleBlobAsync(this IKustoIngestClient client, string blobUri, bool deleteSourceOnSuccess, KustoIngestionProperties ingestionProperties, long? rawDataSize = null);
/// <summary>
/// Ingest data from a single data blob
/// </summary>
/// <param name="client">The ingest client that will execute the ingestions</param>
/// <param name="blobDescription"><see cref="BlobDescription"/> representing the blobs that will be ingested</param>
/// <param name="deleteSourceOnSuccess">Indicates if the source blob should be deleted after a successful ingestion</param>
/// <param name="ingestionProperties">Additional properties to be used during the ingestion process</param>
/// <param name="rawDataSize">The uncompressed raw data size</param>
/// <returns><see cref="IKustoIngestionResult"/></returns>
public static IKustoIngestionResult IngestFromSingleBlob(this IKustoIngestClient client, BlobDescription blobDescription, bool deleteSourceOnSuccess, KustoIngestionProperties ingestionProperties, long? rawDataSize = null);
/// <summary>
/// Ingest data from a single data blob asynchronously
/// </summary>
/// <param name="client">The ingest client that will execute the ingestions</param>
/// <param name="blobDescription"><see cref="BlobDescription"/> representing the blobs that will be ingested</param>
/// <param name="deleteSourceOnSuccess">Indicates if the source blob should be deleted after a successful ingestion</param>
/// <param name="ingestionProperties">Additional properties to be used during the ingestion process</param>
/// <param name="rawDataSize">The uncompressed raw data size</param>
/// <returns>An <see cref="IKustoIngestionResult"/> task</returns>
public static Task<IKustoIngestionResult> IngestFromSingleBlobAsync(this IKustoIngestClient client, BlobDescription blobDescription, bool deleteSourceOnSuccess, KustoIngestionProperties ingestionProperties, long? rawDataSize = null);
/// <summary>
/// Ingest data from <see cref="IDataReader"/>, which is closed and disposed of upon call completion
/// </summary>
/// <param name="client">The ingest client that will execute the ingestions</param>
/// <param name="dataReader">The data to ingest (only the first record set will be used)</param>
/// <param name="ingestionProperties">Additional properties to be used during the ingestion process</param>
/// <returns><see cref="IKustoIngestionResult"/></returns>
public static IKustoIngestionResult IngestFromDataReader(this IKustoIngestClient client, IDataReader dataReader, KustoIngestionProperties ingestionProperties);
/// <summary>
/// Asynchronously ingest data from <see cref="IDataReader"/>, which is closed and disposed of upon call completion
/// </summary>
/// <param name="client">The ingest client that will execute the ingestions</param>
/// <param name="dataReader">The data to ingest (only the first record set will be used)</param>
/// <param name="ingestionProperties">Additional properties to be used during the ingestion process</param>
/// <returns>An <see cref="IKustoIngestionResult"/> task</returns>
public static Task<IKustoIngestionResult> IngestFromDataReaderAsync(this IKustoIngestClient client, IDataReader dataReader, KustoIngestionProperties ingestionProperties);
/// <summary>
/// Ingest data from <see cref="IDataReader"/>, which is closed and disposed of upon call completion
/// </summary>
/// <param name="client">The ingest client that will execute the ingestions</param>
/// <param name="dataReaderDescription"><see cref="DataReaderDescription"/>Represents the data to ingest (only the first record set will be used)</param>
/// <param name="ingestionProperties">Additional properties to be used during the ingestion process</param>
/// <returns><see cref="IKustoIngestionResult"/></returns>
public static IKustoIngestionResult IngestFromDataReader(this IKustoIngestClient client, DataReaderDescription dataReaderDescription, KustoIngestionProperties ingestionProperties);
/// <summary>
/// Asynchronously ingest data from <see cref="IDataReader"/>, which is closed and disposed of upon call completion
/// </summary>
/// <param name="client">The ingest client that will execute the ingestions</param>
/// <param name="dataReaderDescription"><see cref="DataReaderDescription"/>Represents the data to ingest (only the first record set will be used)</param>
/// <param name="ingestionProperties">Additional properties to be used during the ingestion process</param>
/// <returns>An <see cref="IKustoIngestionResult"/> task</returns>
public static Task<IKustoIngestionResult> IngestFromDataReaderAsync(this IKustoIngestClient client, DataReaderDescription dataReaderDescription, KustoIngestionProperties ingestionProperties);
/// <summary>
/// Ingest data from a single file
/// </summary>
/// <param name="client">The ingest client that will execute the ingestions</param>
/// <param name="filePath">Absolute path of the source file to be ingested</param>
/// <param name="deleteSourceOnSuccess">Indicates if the source file should be deleted after a successful ingestion</param>
/// <param name="ingestionProperties">Additional properties to be used during the ingestion process</param>
/// <returns><see cref="IKustoIngestionResult"/></returns>
public static IKustoIngestionResult IngestFromSingleFile(this IKustoIngestClient client, string filePath, bool deleteSourceOnSuccess, KustoIngestionProperties ingestionProperties);
/// <summary>
/// Ingest data from a single file asynchronously
/// </summary>
/// <param name="client">The ingest client that will execute the ingestions</param>
/// <param name="filePath">Absolute path of the source file to be ingested</param>
/// <param name="deleteSourceOnSuccess">Indicates if the source file should be deleted after a successful ingestion</param>
/// <param name="ingestionProperties">Additional properties to be used during the ingestion process</param>
/// <returns>An <see cref="IKustoIngestionResult"/> task</returns>
public static Task<IKustoIngestionResult> IngestFromSingleFileAsync(this IKustoIngestClient client, string filePath, bool deleteSourceOnSuccess, KustoIngestionProperties ingestionProperties);
/// <summary>
/// Ingest data from a single file
/// </summary>
/// <param name="client">The ingest client that will execute the ingestions</param>
/// <param name="fileDescription"><see cref="FileDescription"/> representing the file that will be ingested</param>
/// <param name="deleteSourceOnSuccess">Indicates if the source file should be deleted after a successful ingestion</param>
/// <param name="ingestionProperties">Additional properties to be used during the ingestion process</param>
/// <returns><see cref="IKustoIngestionResult"/></returns>
public static IKustoIngestionResult IngestFromSingleFile(this IKustoIngestClient client, FileDescription fileDescription, bool deleteSourceOnSuccess, KustoIngestionProperties ingestionProperties);
/// <summary>
/// Ingest data from a single file asynchronously
/// </summary>
/// <param name="client">The ingest client that will execute the ingestions</param>
/// <param name="fileDescription"><see cref="FileDescription"/> representing the file that will be ingested</param>
/// <param name="deleteSourceOnSuccess">Indicates if the source file should be deleted after a successful ingestion</param>
/// <param name="ingestionProperties">Additional properties to be used during the ingestion process</param>
/// <returns>An <see cref="IKustoIngestionResult"/> task</returns>
public static Task<IKustoIngestionResult> IngestFromSingleFileAsync(this IKustoIngestClient client, FileDescription fileDescription, bool deleteSourceOnSuccess, KustoIngestionProperties ingestionProperties);
/// <summary>
/// Ingest data from <see cref="Stream"/>
/// </summary>
/// <param name="client">The ingest client that will execute the ingestions</param>
/// <param name="stream">The data to ingest</param>
/// <param name="ingestionProperties">Additional properties to be used during the ingestion process</param>
/// <param name="leaveOpen">Optional. If set to 'false' (default value), <paramref name="stream"/> will be closed and disposed on call completion</param>
/// <returns><see cref="IKustoIngestionResult"/></returns>
public static IKustoIngestionResult IngestFromStream(this IKustoIngestClient client, Stream stream, KustoIngestionProperties ingestionProperties, bool leaveOpen = false);
/// <summary>
/// Ingest data from <see cref="Stream"/> asynchronously
/// </summary>
/// <param name="client">The ingest client that will execute the ingestions</param>
/// <param name="stream">The data to ingest</param>
/// <param name="ingestionProperties">Additional properties to be used during the ingestion process</param>
/// <param name="leaveOpen">Optional. If set to 'false' (default value), <paramref name="stream"/> will be closed and disposed on call completion</param>
/// <returns>An <see cref="IKustoIngestionResult"/> task</returns>
public static Task<IKustoIngestionResult> IngestFromStreamAsync(this IKustoIngestClient client, Stream stream, KustoIngestionProperties ingestionProperties, bool leaveOpen = false);
/// <summary>
/// Ingest data from <see cref="Stream"/>
/// </summary>
/// <param name="client">The ingest client that will execute the ingestions</param>
/// <param name="streamDescription"><see cref="StreamDescription"/>Represents the data to ingest</param>
/// <param name="ingestionProperties">Additional properties to be used during the ingestion process</param>
/// <param name="leaveOpen">Optional. If set to 'false' (default value), streamDescription.Stream will be closed and disposed on call completion</param>
/// <returns><see cref="IKustoIngestionResult"/></returns>
public static IKustoIngestionResult IngestFromStream(this IKustoIngestClient client, StreamDescription streamDescription, KustoIngestionProperties ingestionProperties, bool leaveOpen = false);
/// <summary>
/// Ingest data from <see cref="Stream"/> asynchronously
/// </summary>
/// <param name="client">The ingest client that will execute the ingestions</param>
/// <param name="streamDescription"><see cref="StreamDescription"/>Represents the data to ingest</param>
/// <param name="ingestionProperties">Additional properties to be used during the ingestion process</param>
/// <param name="leaveOpen">Optional. If set to 'false' (default value), streamDescription.Stream will be closed and disposed on call completion</param>
/// <returns>An <see cref="IKustoIngestionResult"/> task</returns>
public static Task<IKustoIngestionResult> IngestFromStreamAsync(this IKustoIngestClient client, StreamDescription streamDescription, KustoIngestionProperties ingestionProperties, bool leaveOpen = false);
}
类 KustoIngestFactoryClass KustoIngestFactory
- CreateDirectIngestClientCreateDirectIngestClient
- CreateQueuedIngestClientCreateQueuedIngestClient
- CreateManagedStreamingIngestClientCreateManagedStreamingIngestClient
- CreateStreamingIngestClientCreateStreamingIngestClient
/// <summary>
/// Factory for creating Kusto ingestion objects.
/// </summary>
public static class KustoIngestFactory
{
/// <summary>
/// Creates an implementation of <see cref="IKustoIngestClient"/> that communicates
/// directly with the Kusto engine service.
/// </summary>
/// <param name="kcsb">Indicates the connection to the Kusto engine service.</param>
/// <returns>An implementation of <see cref="IKustoIngestClient"/> that communicates
/// directly with the Kusto engine service.</returns>
/// <remarks>In most cases, it is preferred that ingestion be done using the
/// queued implementation of <see cref="IKustoIngestClient"/>. See <see cref="CreateQueuedIngestClient(KustoConnectionStringBuilder)"/>.</remarks>
public static IKustoIngestClient CreateDirectIngestClient(KustoConnectionStringBuilder kcsb);
/// <summary>
/// Creates an implementation of <see cref="IKustoIngestClient"/> that communicates
/// directly with the Kusto engine service.
/// </summary>
/// <param name="connectionString">Indicates the connection to the Kusto engine service.</param>
/// <returns>An implementation of <see cref="IKustoIngestClient"/> that communicates
/// directly with the Kusto engine service.</returns>
/// <remarks>In most cases, it is preferred that ingestion be done using the
/// queued implementation of <see cref="IKustoIngestClient"/>. See <see cref="CreateQueuedIngestClient(string)"/>.</remarks>
public static IKustoIngestClient CreateDirectIngestClient(string connectionString);
/// <summary>
/// Creates an implementation of <see cref="IKustoQueuedIngestClient"/> that communicates
/// with the Kusto ingestion service using a reliable queue.
/// </summary>
/// <param name="kcsb">Indicates the connection to the Kusto ingestion service.
/// Note that the ingestion service generally has a "ingest-" prefix in the
/// DNS host name part.</param>
/// <returns>An implementation of <see cref="IKustoQueuedIngestClient"/> that communicates
/// with the Kusto ingestion service using a reliable queue.</returns>
public static IKustoQueuedIngestClient CreateQueuedIngestClient(KustoConnectionStringBuilder kcsb);
/// <summary>
/// Creates an implementation of <see cref="IKustoQueuedIngestClient"/> that communicates
/// with the Kusto ingestion service using a reliable queue.
/// </summary>
/// <param name="connectionString">Indicates the connection to the Kusto ingestion service.
/// Note that the ingestion service generally has a "ingest-" prefix in the
/// DNS host name part.</param>
/// <returns>An implementation of <see cref="IKustoQueuedIngestClient"/> that communicates with the Kusto ingestion service using a reliable queue.</returns>
public static IKustoQueuedIngestClient CreateQueuedIngestClient(string connectionString);
/// <summary>
/// Creates an implementation of <see cref="IKustoIngestClient"/> that performs managed streaming ingestion
/// </summary>
/// <param name="engineKcsb">Indicates the connection to the Kusto engine service.</param>
/// <param name="dmKcsb">Indicates the connection to the Kusto data management service.</param>
/// <returns>An implementation of <see cref="IKustoIngestClient"/> that performs managed streaming ingestion</returns>
/// <remarks>Streaming ingestion is performed directy intto Kusto enginge cluster
/// and is optimized for low-latency ingestion of relatively small chunks of data.
/// If the streaming ingset doesn't succeed after several retries, queued ingestion will be performed.</remarks>
public static IKustoIngestClient CreateManagedStreamingIngestClient(KustoConnectionStringBuilder engineKcsb, KustoConnectionStringBuilder dmKcsb);
/// <summary>
/// Creates an implementation of <see cref="IKustoIngestClient"/> that performs managed streaming ingestion
/// </summary>
/// <param name="engineConnectionString">Indicates the connection to the Kusto engine service.</param>
/// <param name="dmConnectionString">Indicates the connection to the Kusto data management service.</param>
/// <returns>An implementation of <see cref="IKustoIngestClient"/> that performs managed streaming ingestion</returns>
/// <remarks>Streaming ingestion is performed directy intto Kusto enginge cluster
/// and is optimized for low-latency ingestion of relatively small chunks of data.
/// If the streaming ingset doesn't succeed after several retries, queued ingestion will be performed.</remarks>
public static IKustoIngestClient CreateManagedStreamingIngestClient(string engineConnectionString, string dmConnectionString);
/// <summary>
/// Creates an implementation of <see cref="IKustoIngestClient"/> that performs streaming ingestion
/// </summary>
/// <param name="kcsb">Indicates the connection to the Kusto engine service.</param>
/// <returns>An implementation of <see cref="IKustoIngestClient"/> that performs streaming ingestion</returns>
/// <remarks>Streaming ingestion is performed directy intto Kusto enginge cluster
/// and is optimized for low-latency ingestion of relatively small chunks of data</remarks>
public static IKustoIngestClient CreateStreamingIngestClient(KustoConnectionStringBuilder kcsb);
/// <summary>
/// Creates an implementation of <see cref="IKustoIngestClient"/> that performs streaming ingestion
/// </summary>
/// <param name="connectionString">Indicates the connection to the Kusto engine service.</param>
/// <returns>An implementation of <see cref="IKustoIngestClient"/> that performs streaming ingestion</returns>
/// <remarks>Streaming ingestion is performed directy into Kusto enginge cluster
/// and is optimized for low-latency ingestion of relatively small chunks of data</remarks>
public static IKustoIngestClient CreateStreamingIngestClient(string connectionString);
}
类 KustoIngestionPropertiesClass KustoIngestionProperties
KustoIngestionProperties 类包含基本引入属性,可用于精细控制引入过程以及 Kusto 引擎处理该过程的方式。KustoIngestionProperties class contains basic ingestion properties for fine control over the ingestion process and the way Kusto engine will handle it.
属性Property | 含义Meaning |
---|---|
DatabaseNameDatabaseName | 要将数据引入到其中的数据库的名称Name of the database to ingest into |
TableNameTableName | 要将数据引入到其中的表的名称Name of the table to ingest into |
DropByTagsDropByTags | 每个盘区都会有的标记。Tags that each extent will have. DropByTags 是永久性的,可以按如下方式使用:.show table T extents where tags has 'some tag' 或 .drop extents <| .show table T extents where tags has 'some tag' DropByTags are permanent and can be used as follows: .show table T extents where tags has 'some tag' or .drop extents <| .show table T extents where tags has 'some tag' |
IngestByTagsIngestByTags | 按盘区写入的标记。Tags that are written per extent. 以后可以与 IngestIfNotExists 属性一起使用,以免引入相同的数据两次Can later be used with the IngestIfNotExists property to avoid ingesting the same data twice |
IngestionMappingIngestionMapping | 保存对现有映射的引用或列映射列表Holds either a reference to an exiting mapping or a list of column mappings |
AdditionalTagsAdditionalTags | 根据需要附加的标记Additional tags as needed |
IngestIfNotExistsIngestIfNotExists | 不希望再次引入的标记的列表(按表)List of tags that you don't want to ingest again (per table) |
ValidationPolicyValidationPolicy | 数据验证定义。Data validation definitions. 有关详细信息,请参阅 [TODO]See [TODO] for details |
格式Format | 要引入的数据的格式Format of the data being ingested |
AdditionalPropertiesAdditionalProperties | 其他将作为引入属性传递给引入命令的属性。Other properties that will be passed as ingestion properties to the ingestion command. 这些属性会被传递,因为并非所有引入属性都以此类的独立成员的形式表示The properties will be passed because not all of the ingestion properties are represented in a separate member of this class |
public class KustoIngestionProperties
{
public string DatabaseName { get; set; }
public string TableName { get; set; }
public IEnumerable<string> DropByTags { get; set; }
public IEnumerable<string> IngestByTags { get; set; }
public IEnumerable<string> AdditionalTags { get; set; }
public IEnumerable<string> IngestIfNotExists { get; set; }
public IngestionMapping IngestionMapping { get; set; }
public ValidationPolicy ValidationPolicy { get; set; }
public DataSourceFormat? Format { get; set; }
public bool IgnoreSizeLimit { get; set; } // Determines whether the limit of 4GB per single ingestion source should be ignored. Defaults to false.
public IDictionary<string, string> AdditionalProperties { get; set; }
public KustoIngestionProperties(string databaseName, string tableName);
}
类 IngestionMappingClass IngestionMapping
保存对现有映射的引用或列映射列表。Holds a reference to an existing mapping or a list of column mappings.
属性Property | 含义Meaning |
---|---|
IngestionMappingsIngestionMappings | 列映射,每个列映射均描述目标列数据及其源Column mappings, each describing the target column data and its source |
IngestionMappingKindIngestionMappingKind | IngestionMappings 属性中描述的映射的类型 - 以下类型之一:Csv、Json、Avro、Parquet、SStream、Orc、ApacheAvro 或 W3CLogFileKind of mapping described in the IngestionMappings property - one of: Csv, Json, Avro, Parquet, SStream, Orc, ApacheAvro or W3CLogFile |
IngestionMappingReferenceIngestionMappingReference | 预先创建的映射名称The pre-created mapping name |
public class IngestionMapping
{
public IEnumerable<ColumnMapping> IngestionMappings { get; set; }
public IngestionMappingKind IngestionMappingKind { get; set; }
public string IngestionMappingReference { get; set; }
public IngestionMapping()
public IngestionMapping(IngestionMapping ingestionMapping)
}
枚举 DataSourceFormatEnum DataSourceFormat
public enum DataSourceFormat
{
csv, // Data is in a CSV(-comma-separated values) format
tsv, // Data is in a TSV(-tab-separated values) format
scsv, // Data is in a SCSV(-semicolon-separated values) format
sohsv, // Data is in a SOHSV(-SOH (ASCII 1) separated values) format
psv, // Data is in a PSV (pipe-separated values) format
tsve, // Tab-separated value with '\' escaping character.
txt, // Each record is a line and has just one field
raw, // The entire stream/file/blob is a single record having a single field
json, // Data is in a JSON-line format (each line is record with a single JSON value)
multijson, // The data stream is a concatenation of JSON documents (property bags all)
avro, // Data is in a AVRO format
orc, // Data is in a ORC format
parquet, // Data is in a Parquet format
}
KustoIngestionProperties 定义的示例Example of KustoIngestionProperties definition
var guid = new Guid().ToString();
var kustoIngestionProperties = new KustoIngestionProperties("TargetDatabase", "TargetTable")
{
DropByTags = new List<string> { DateTime.Today.ToString() },
IngestByTags = new List<string> { guid },
AdditionalTags = new List<string> { "some tags" },
IngestIfNotExists = new List<string> { guid },
IngestionMapping = new IngestionMapping() {
IngestionMappingKind = Data.Ingestion.IngestionMappingKind.Csv,
IngestionMappings = new ColumnMapping[] { new ColumnMapping() {
ColumnName = "stringColumn",
Properties = new Dictionary<string, string>() {
{ MappingConsts.Ordinal, "1"} }
} },
},
ValidationPolicy = new ValidationPolicy { ValidationImplications = ValidationImplications.Fail, ValidationOptions = ValidationOptions.ValidateCsvInputConstantColumns },
Format = DataSourceFormat.csv
};
接口 IKustoQueuedIngestClientInterface IKustoQueuedIngestClient
IKustoQueuedIngestClient 接口添加了用于跟踪引入操作结果的跟踪方法,并为引入客户端公开 RetryPolicy。IKustoQueuedIngestClient interface adds tracking methods that follow the ingestion operation result and exposes RetryPolicy for the ingest client.
- PeekTopIngestionFailuresPeekTopIngestionFailures
- GetAndDiscardTopIngestionFailuresGetAndDiscardTopIngestionFailures
- GetAndDiscardTopIngestionSuccessesGetAndDiscardTopIngestionSuccesses
public interface IKustoQueuedIngestClient : IKustoIngestClient
{
/// <summary>
/// Peeks top (== oldest) ingestion failures
/// </summary>
/// <param name="messagesLimit">Maximum ingestion failures to peek. Default value peeks 32 messages.</param>
/// <returns>A task which its result contains IEnumerable of <see cref="IngestionFailure"/>. The received messages won't be discarded from the relevant azure queue.</returns>
Task<IEnumerable<IngestionFailure>> PeekTopIngestionFailures(int messagesLimit = -1);
/// <summary>
/// Returns and deletes top (== oldest) ingestion failure notifications
/// </summary>
/// <param name="messagesLimit">Maximum ingestion failure notifications to get. Default value peeks 32 messages.</param>
/// <returns>A task which its result contains IEnumerable of <see cref="IngestionFailure"/>. The received messages will be discarded from the relevant azure queue.</returns>
Task<IEnumerable<IngestionFailure>> GetAndDiscardTopIngestionFailures(int messagesLimit = -1);
/// <summary>
/// Returns and deletes top (== oldest) ingestion success notifications
/// </summary>
/// <param name="messagesLimit">Maximum ingestion success notifications to get. Default value peeks 32 messages.</param>
/// <returns>A task which its result contains IEnumerable of <see cref="IngestionSuccess"/>. The received messages will be discarded from the relevant azure queue.</returns>
Task<IEnumerable<IngestionSuccess>> GetAndDiscardTopIngestionSuccesses(int messagesLimit = -1);
/// <summary>
/// An implementation of IRetryPolicy that will be enforced on every ingest call,
/// which affects how the ingest client handles retrying on transient failures
/// </summary>
IRetryPolicy QueueRetryPolicy { get; set; }
}
类 KustoQueuedIngestionPropertiesClass KustoQueuedIngestionProperties
KustoQueuedIngestionProperties 类使用几个可用于微调引入行为的控制旋钮扩展了 KustoIngestionProperties。KustoQueuedIngestionProperties class extends KustoIngestionProperties with several control knobs that can be used to fine-tune the ingestion behavior.
属性Property | 含义Meaning |
---|---|
FlushImmediatelyFlushImmediately | 默认为 false 。Defaults to false . 如果设为 true ,将绕过数据管理服务的聚合机制If set to true , will bypass aggregation mechanism of the Data Management service |
IngestionReportLevelIngestionReportLevel | 控制引入状态报告的级别(默认为 FailuresOnly )。Controls the level of ingestion status reporting (defaults to FailuresOnly ). 为了获得良好的性能和存储使用率,建议你不要将 IngestionReportLevel 设为 FailuresAndSuccesses For good performance and storage usage, we recommended you not set IngestionReportLevel to FailuresAndSuccesses |
IngestionReportMethodIngestionReportMethod | 控制引入状态报告的目标。Controls the target of the ingestion status reporting. 可用选项包括:Azure 队列和/或 Azure 表。Available options are: Azure Queue, Azure Table, or both. 默认为 Queue 。Defaults to Queue . |
public class KustoQueuedIngestionProperties : KustoIngestionProperties
{
/// <summary>
/// Allows to stop the batching phase and will cause to an immediate ingestion.
/// Defaults to 'false'.
/// </summary>
public bool FlushImmediately { get; set; }
/// <summary>
/// Controls the ingestion status report level.
/// Defaults to 'FailuresOnly'.
/// </summary>
public IngestionReportLevel ReportLevel { get; set; }
/// <summary>
/// Controls the target of the ingestion status reporting. Available options are Azure Queue, Azure Table, or both.
/// Defaults to 'Queue'.
/// </summary>
public IngestionReportMethod ReportMethod { get; set; }
/// <summary>
/// Controls the target of the ingestion status reporting. Available options are Azure Queue, Azure Table, or both.
/// Defaults to 'Queue'.
/// </summary>
public IngestionReportMethod ReportMethod;
public KustoQueuedIngestionProperties(string databaseName, string tableName);
}