himanchalkaushale opened a new pull request, #4710:
URL: https://github.com/apache/iggy/pull/4710
## Which issue does this PR address?
Closes #4700
## Rationale
The Python examples were missing a sink data producer. Adding one makes it
easier to generate sample JSON records for sink connectors and brings the
Python examples in line with the existing Rust implementation.
## What changed?
Added `examples/python/sink-data-producer/producer.py`, which:
- Reads `IGGY_STREAM` (default: `qw`) and `IGGY_TOPIC` (default: `records`)
from environment variables.
- Connects to the Iggy server using `IggyClient.from_connection_string()`.
- Creates the stream and topic if they don't already exist.
- Generates 100 batches of 100 to 500 JSON records each.
- Uses the same record structure as the Rust implementation:
- `user_id` (string)
- `user_type` (integer)
- `email` (string)
- `source` (string)
- `state` (string)
- `created_at` (ISO-formatted string)
- `message` (string)
- Sends records using `Partitioning.balanced()` and `DirectProducerConfig`.
- Keeps the stream and topic after execution, following the Rust
implementation.
Also updated `examples/python/README.md` with instructions for running the
new example, configuring environment variables, and understanding its behaviour.
## Local Execution
- Python syntax was validated using `ast.parse`.
- SDK methods were checked against the existing Python examples and type
stubs.
- Record fields and generation logic were compared with the Rust
implementation.
- Pre-commit hooks were not run.
## AI Usage
AI was used to assist with repository exploration, implementation, and
documentation.
- **Development assistance:** Reviewed existing Python and Rust examples
while implementing the producer.
- **Verification:** Cross-checked the implementation against existing SDK
examples and repository conventions.
I reviewed the changes and can explain the implementation and its design
decisions.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]