Skip to content

Kafka BasicAuth

KafkaBasicAuth

Bases: KafkaAuth, GenericOptions

Connect to Kafka using sasl.mechanism="PLAIN".

For more details see Kafka Documentation.

Added in 0.9.0

Examples:

Auth in Kafka with user and password:

from onetl.connection import Kafka

auth = Kafka.BasicAuth(
    user="some_user",
    password="abc",
)

cleanup(kafka)

This method is called while closing Kafka connection.

Implement it to cleanup resources like temporary files.

Parameters:

  • kafka (Kafka) –

    Connection instance

get_options(kafka)

Get options for Kafka connection

Parameters:

  • kafka (Kafka) –

    Connection instance

Returns:

  • dict ( dict ) –

    Kafka client options

parse(options) classmethod

If a parameter inherited from the ReadOptions class was passed, then it will be returned unchanged. If a Dict object was passed it will be converted to ReadOptions.

Otherwise, an exception will be raised