File: data_format.py

package info (click to toggle)
azure-kusto-python 5.0.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,704 kB
  • sloc: python: 10,633; sh: 13; makefile: 3
file content (42 lines) | stat: -rw-r--r-- 1,702 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License
from enum import Enum


class IngestionMappingKind(Enum):
    CSV = "Csv"
    JSON = "Json"
    AVRO = "Avro"
    APACHEAVRO = "ApacheAvro"
    PARQUET = "Parquet"
    SSTREAM = "SStream"
    ORC = "Orc"
    W3CLOGFILE = "W3CLogFile"
    UNKNOWN = "Unknown"


class DataFormat(Enum):
    """All data formats supported by Kusto."""

    CSV = ("csv", IngestionMappingKind.CSV, True)
    TSV = ("tsv", IngestionMappingKind.CSV, True)
    SCSV = ("scsv", IngestionMappingKind.CSV, True)
    SOHSV = ("sohsv", IngestionMappingKind.CSV, True)
    PSV = ("psv", IngestionMappingKind.CSV, True)
    TXT = ("txt", IngestionMappingKind.CSV, True)
    TSVE = ("tsve", IngestionMappingKind.CSV, True)
    JSON = ("json", IngestionMappingKind.JSON, True)
    SINGLEJSON = ("singlejson", IngestionMappingKind.JSON, True)
    MULTIJSON = ("multijson", IngestionMappingKind.JSON, True)
    AVRO = ("avro", IngestionMappingKind.AVRO, False)
    APACHEAVRO = ("apacheavro", IngestionMappingKind.APACHEAVRO, False)
    PARQUET = ("parquet", IngestionMappingKind.PARQUET, False)
    SSTREAM = ("sstream", IngestionMappingKind.SSTREAM, False)
    ORC = ("orc", IngestionMappingKind.ORC, False)
    RAW = ("raw", IngestionMappingKind.CSV, True)
    W3CLOGFILE = ("w3clogfile", IngestionMappingKind.W3CLOGFILE, True)

    def __init__(self, kusto_value: str, ingestion_mapping_kind: IngestionMappingKind, compressible: bool):
        self.kusto_value = kusto_value  # Formatted how Kusto Service expects it
        self.ingestion_mapping_kind = ingestion_mapping_kind
        self.compressible = compressible  # Binary formats should not be compressed