Kafka Connect Python
The Kafka Connect REST API allows you to manage connectors that move data between Apache Kafka and other systems.
The kc command line tool provides commands for getting information about the Kafka Connect cluster and its connectors, creating new connectors, updating existing connectors, deleting connectors, etc.
This project aims to supported all features of the Kafka Connect REST API.
Install
pip install kafka-connect-py
Command Line Usage
Get the version and other details of the Kafka Connect cluster.
kc info
Get a list of active connectors.
kc list
kc list [--expand=status|info]
Get the details of a single connector.
kc get <connector>
Get the status of a connector.
kc status <connector>
Get the config of a connector.
kc config <connector>
Create a new connector.
kc create <config-file>
Update the configuration for an existing connector.
kc update <connector> <config_file>
Restart a connector.
kc restart <connector>
Pause a connector.
kc pause <connector>
Resume a connector.
kc resume <connector>
Delete a connector.
kc delete <connector>
Python
# Import the class
from kafka_connect import KafkaConnect
# Instantiate the client
client = KafkaConnect(endpoint="http://localhost:8083")
# Get the version and other details of the Kafka Connect cluster
cluster = client.get_info()
print(cluster)
# Get a list of active connectors
connectors = client.get_connectors()
print(connectors)
# Create a new connector
config = {
"name": "my-connector",
"config": {
"connector.class": "io.confluent.connect.jdbc.JdbcSourceConnector",
"tasks.max": "1",
"connection.url": "jdbc:postgresql://localhost:5432/mydatabase",
"connection.user": "myuser",
"connection.password": "mypassword",
"table.whitelist": "mytable",
"mode": "timestamp+incrementing",
"timestamp.column.name": "modified_at",
"validate.non.null": "false",
"incrementing.column.name": "id",
"topic.prefix": "my-connector-",
},
}
response = client.create_connector(config)
print(response)
# Update an existing connector
new_config = {
"config": {
"connector.class": "io.confluent.connect.jdbc.JdbcSourceConnector",
"tasks.max": "1",
"connection.url": "jdbc:postgresql://localhost:5432/mydatabase",
"connection.user": "myuser",
"connection.password": "mypassword",
"table.whitelist": "mytable",
"mode": "timestamp+incrementing",
"timestamp.column.name": "modified_at",
"validate.non.null": "false",
"incrementing.column.name": "id",
"topic.prefix": "my-connector-",
},
}
response = client.update_connector("my-connector", new_config)
print(response)
# Restart a connector
response = client.restart_connector("my-connector")
print(response)
# Delete a connector
response = client.delete_connector("my-connector")
print(response)
Tests
python3 -m unittest tests/test_kafka_connect.py -v
Metadata
Release files for kafka-connect-py 0.3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| kafka_connect_py-0.3.1.tar.gz | 7.2 kB | Without provenance | Details for kafka_connect_py-0.3.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| kafka_connect_py-0.3.1-py3-none-any.whl | Python 3 | none | any | Details for kafka_connect_py-0.3.1-py3-none-any.whl |
Total release size: 14.4 kB
Release files / kafka_connect_py-0.3.1.tar.gz
| Download URL | kafka_connect_py-0.3.1.tar.gz |
|---|---|
| Size | 7.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e8fc0b5bedd83ef029e175ee80481651c4ea6bde738636feb7e394f00f621a83
|
|
BLAKE2b-256 checksum How to use checksums |
a5ccd825b008f110ddad7f46091b427ec511fefb67287a554fe6a118073513fd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.3.1 CPython/3.11.0 Darwin/20.6.0
|
Release files / kafka_connect_py-0.3.1-py3-none-any.whl
| Download URL | kafka_connect_py-0.3.1-py3-none-any.whl |
|---|---|
| Size | 7.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1a6fb25f13fb68eb0d762cf286265f66293cbd906b54d222c70701519236a4e0
|
|
BLAKE2b-256 checksum How to use checksums |
374a7cb1c469f6d5285cfe4fa3a84a72a6d46cfda11dbb03a2b31800b7644cbd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.3.1 CPython/3.11.0 Darwin/20.6.0
|
Security for kafka-connect-py 0.3.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.