Skip to content

Commit 1a8e642

Browse files
committed
Added and polished some comments
1 parent 94d3a44 commit 1a8e642

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

sample_append.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@
2121
data=b'{"Id":"1", "importantData":"some value"}' # Specify the event data body as a JSON in byte format
2222
)
2323

24-
########################################################
24+
##################################################
2525
#
26-
# Step 3. Append the event object into the SampleStream
26+
# Step 3. Append the event object into the stream
2727
#
28-
########################################################
28+
##################################################
2929

3030
event_stream = "SampleStream" # Define the stream name where the event will be appended
31-
client.append_to_stream( # Append the event to the SampleStream
31+
client.append_to_stream( # Append the event to a stream
3232
event_stream, # Name of the stream to append the event to
3333
events=[new_event], # The event to append (in a list)
3434
current_version=StreamState.ANY # Set to append regardless of the current stream state (you can ignore this for now)

sample_read.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
# Create an instance of EventStoreDBClient, connecting to the EventStoreDB at localhost without TLS
1010
client = EventStoreDBClient(uri="esdb://localhost:2113?tls=false")
1111

12-
################################################
12+
##########################################
1313
#
14-
# Step 2. Read all events from the SampleStream
14+
# Step 2. Read all events from the stream
1515
#
16-
################################################
16+
##########################################
1717

1818
events = client.get_stream("SampleStream") # Read all events from SampleStream
1919

@@ -23,12 +23,12 @@
2323
#
2424
######################################
2525

26-
for event in events:
27-
print("************************");
28-
print("You have read an event!");
29-
print("Stream: " + event.stream_name);
30-
print("Event Type: " + event.type);
31-
print("Event Body: " + event.data.decode());
26+
for event in events: # For each event
27+
print("************************"); #
28+
print("You have read an event!"); #
29+
print("Stream: " + event.stream_name); # Print the stream name of the event
30+
print("Event Type: " + event.type); # Print the type of the event
31+
print("Event Body: " + event.data.decode()); # Print the body of the event after converting it to string from a byte array
3232
print("************************");
3333

3434
client.close()

0 commit comments

Comments
 (0)