PDP Kafka package
Project description
PDP Kafka Reader
Requirements
- git
- python 3.6+
- pip
Also, you need access to the git repository. Generate and use ssh keys in Skyway Bitbucket.
Install
pip install pdp_kafka_reader
Usage
CLI
You can use kafka-csv-export
CLI tool to extract avro data into csv from a specific avro topic. An example of usage:
kafka-csv-export -k kafka-options.json -s schema.json -t my_kafka_topic -o out.csv
Python KafkaReader
import json
from pdp_kafka_reader.kafka_reader import KafkaAvroReader
kafka_options = {
"kafka.bootstrap.servers": "my-kafka-server:9092",
"subscribe": "test_avro"
}
avro_schema = open("schema.json").read()
reader = KafkaAvroReader(spark)
df = reader.read_avro(kafka_options, avro_schema, "my_kafka_topic")
df.show()
Testing
Testing environment in defined in docker-compose.yml
. Start docker containers and run tox
.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pdp-kafka-reader-0.0.3.tar.gz
(171.1 kB
view hashes)
Built Distribution
Close
Hashes for pdp_kafka_reader-0.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bb8c45dcfa71e56724f2dc1e42467d7bc952b9c033985494f4949a8085113ef2 |
|
MD5 | daf452b413a95130e913d1983f7e6272 |
|
BLAKE2b-256 | b41c85adbb8031e3ed5018dabc2a1c560bf75a5ff2245ca1727db3412d032561 |