Glue / Client / create_classifier

create_classifier#

Glue.Client.create_classifier(**kwargs)#

Creates a classifier in the user’s account. This can be a GrokClassifier, an XMLClassifier, a JsonClassifier, or a CsvClassifier, depending on which field of the request is present.

See also: AWS API Documentation

Request Syntax

response = client.create_classifier(
    GrokClassifier={
        'Classification': 'string',
        'Name': 'string',
        'GrokPattern': 'string',
        'CustomPatterns': 'string'
    },
    XMLClassifier={
        'Classification': 'string',
        'Name': 'string',
        'RowTag': 'string'
    },
    JsonClassifier={
        'Name': 'string',
        'JsonPath': 'string'
    },
    CsvClassifier={
        'Name': 'string',
        'Delimiter': 'string',
        'QuoteSymbol': 'string',
        'ContainsHeader': 'UNKNOWN'|'PRESENT'|'ABSENT',
        'Header': [
            'string',
        ],
        'DisableValueTrimming': True|False,
        'AllowSingleColumn': True|False,
        'CustomDatatypeConfigured': True|False,
        'CustomDatatypes': [
            'string',
        ],
        'Serde': 'OpenCSVSerDe'|'LazySimpleSerDe'|'None'
    }
)
Parameters:
  • GrokClassifier (dict) –

    A GrokClassifier object specifying the classifier to create.

    • Classification (string) – [REQUIRED]

      An identifier of the data format that the classifier matches, such as Twitter, JSON, Omniture logs, Amazon CloudWatch Logs, and so on.

    • Name (string) – [REQUIRED]

      The name of the new classifier.

    • GrokPattern (string) – [REQUIRED]

      The grok pattern used by this classifier.

    • CustomPatterns (string) –

      Optional custom grok patterns used by this classifier.

  • XMLClassifier (dict) –

    An XMLClassifier object specifying the classifier to create.

    • Classification (string) – [REQUIRED]

      An identifier of the data format that the classifier matches.

    • Name (string) – [REQUIRED]

      The name of the classifier.

    • RowTag (string) –

      The XML tag designating the element that contains each record in an XML document being parsed. This can’t identify a self-closing element (closed by />). An empty row element that contains only attributes can be parsed as long as it ends with a closing tag (for example, <row item_a="A" item_b="B"></row> is okay, but <row item_a="A" item_b="B" /> is not).

  • JsonClassifier (dict) –

    A JsonClassifier object specifying the classifier to create.

    • Name (string) – [REQUIRED]

      The name of the classifier.

    • JsonPath (string) – [REQUIRED]

      A JsonPath string defining the JSON data for the classifier to classify. Glue supports a subset of JsonPath, as described in Writing JsonPath Custom Classifiers.

  • CsvClassifier (dict) –

    A CsvClassifier object specifying the classifier to create.

    • Name (string) – [REQUIRED]

      The name of the classifier.

    • Delimiter (string) –

      A custom symbol to denote what separates each column entry in the row.

    • QuoteSymbol (string) –

      A custom symbol to denote what combines content into a single column value. Must be different from the column delimiter.

    • ContainsHeader (string) –

      Indicates whether the CSV file contains a header.

    • Header (list) –

      A list of strings representing column names.

      • (string) –

    • DisableValueTrimming (boolean) –

      Specifies not to trim values before identifying the type of column values. The default value is true.

    • AllowSingleColumn (boolean) –

      Enables the processing of files that contain only one column.

    • CustomDatatypeConfigured (boolean) –

      Enables the configuration of custom datatypes.

    • CustomDatatypes (list) –

      Creates a list of supported custom datatypes.

      • (string) –

    • Serde (string) –

      Sets the SerDe for processing CSV in the classifier, which will be applied in the Data Catalog. Valid values are OpenCSVSerDe, LazySimpleSerDe, and None. You can specify the None value when you want the crawler to do the detection.

Return type:

dict

Returns:

Response Syntax

{}

Response Structure

  • (dict) –

Exceptions

  • Glue.Client.exceptions.AlreadyExistsException

  • Glue.Client.exceptions.InvalidInputException

  • Glue.Client.exceptions.OperationTimeoutException