Skip to main content

Stream data to Apache Kafka.

Project description

https://github.com/lostclus/django-kafka-streamer/actions/workflows/tests.yml/badge.svg Current version on PyPi PyPI - Python Version PyPI - Django Version

django-kafka-streamer is a Django application and library for streaming data to Apache Kafka.

Features:

  • Setup signal handlers to ORM models to transparently send create/update/delete events to Kafka

  • Handle database object relations

  • Celery task to stream large amount of data in background

Links:

Usage:

yourapp/models.py:

from django.db import models

class MyModel(models.Model):
    field1 = models.IntegerField()
    field2 = models.CharField(max_length=10)

yourapp/stramers.py:

from kafkastreamer import Streamer, register
from .models import MyModel

@register(MyModel)
class MyModelStreamer(Streamer):
    topic = "model-a"

yourproject/settings.py:

INSTALLED_APPS = [
    ...
    "kafkastreamer",
]

KAFKA_STREAMER = {
    "BOOTSTRAP_SERVERS": ["localhost:9092"],
},

Any changes in MyModel data will be automatically streamed to Kafka. To force stream all data in all registered models type:

python manage.py kafkastreamer_refresh

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

django_kafka_streamer-1.3.1.tar.gz (23.2 kB view details)

Uploaded Source

Built Distribution

django_kafka_streamer-1.3.1-py3-none-any.whl (19.4 kB view details)

Uploaded Python 3

File details

Details for the file django_kafka_streamer-1.3.1.tar.gz.

File metadata

  • Download URL: django_kafka_streamer-1.3.1.tar.gz
  • Upload date:
  • Size: 23.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.6

File hashes

Hashes for django_kafka_streamer-1.3.1.tar.gz
Algorithm Hash digest
SHA256 441226353f082301b84b19477007636a1dfc002773b1f300c83ca998bea1a7b0
MD5 70a6e05fb83ef918d818bddb437108ba
BLAKE2b-256 07fafbb7ea87c2897eb3d80b4fe94c4ec67b0fab7a6aedc2a8c0ea4f5f605f9b

See more details on using hashes here.

File details

Details for the file django_kafka_streamer-1.3.1-py3-none-any.whl.

File metadata

File hashes

Hashes for django_kafka_streamer-1.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0a2c8ac85449d0f5fb620e04e95c246d10d5df4cd2d6ea69ad7218c386128e8b
MD5 2863f012bbf8f22c1c99ee9d800c304d
BLAKE2b-256 19c4cc80a1fa10b6a93a0caeccc3a116a4122044a0affcc301692f80258a3d66

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page