Skip to content

Kafka BasicAuth

KafkaBasicAuth

Bases: KafkaAuth, GenericOptions

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

For more details see Kafka Documentation <https://kafka.apache.org/documentation/#security_sasl_plain>_.

.. versionadded:: 0.9.0

Examples:

Auth in Kafka with user and password:

.. code:: python

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 (:obj:Kafka <onetl.connection.db_connection.kafka.connection.Kafka>) –

    Connection instance

get_options(kafka)

Get options for Kafka connection

Parameters:

  • kafka (:obj:Kafka <onetl.connection.db_connection.kafka.connection.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