Skip to content

Commit

Permalink
docs: update Streaming feature computation with Denormalized
Browse files Browse the repository at this point in the history
  • Loading branch information
emgeee committed Nov 13, 2024
1 parent dd7bcba commit 1f173c1
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions docs/reference/denormalized.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ Denormalized makes it easy to compute real-time features and write them directly

## Prerequisites

- Python 3.8+
- Kafka cluster (local or remote)
- Python 3.12+
- Kafka cluster (local or remote) OR docker installed

For a full working demo, check out the [feast-example](https://github.com/probably-nothing-labs/feast-example) repo.

Expand Down Expand Up @@ -39,6 +39,13 @@ my-feature-project/
└── main.py # Pipeline runner
```

3. Run a test Kafka instance in docker

`docker run --rm -p 9092:9092 emgeee/kafka_emit_measurements:latest`

This will spin up a docker container that runs a kafka instance and run a simple script to emit fake data to two topics.


## Define Your Features

In `feature_repo/sensor_data.py`, define your feature view and entity:
Expand Down Expand Up @@ -85,7 +92,7 @@ sample_event = {
}

# Create a stream from your Kafka topic
ds = FeastDataStream(Context().from_topic("temperature", json.dumps(sample_event), "localhost:9092"))
ds = FeastDataStream(Context().from_topic("temperature", json.dumps(sample_event), "localhost:9092", "occurred_at_ms"))

# Define your feature computations
ds = ds.window(
Expand All @@ -106,7 +113,9 @@ feature_store = FeatureStore(repo_path="feature_repo/")
ds.write_feast_feature(feature_store, "push_sensor_statistics")
```



## Need Help?

- Email us at [email protected]
- Check out more examples on our [GitHub](https://github.com/probably-nothing-labs/denormalized)
- Check out more examples on our [GitHub](https://github.com/probably-nothing-labs/denormalized/tree/main/py-denormalized/python/examples)

0 comments on commit 1f173c1

Please sign in to comment.