Python Output Adapter (Receiving Data from a Sybase CEP Stream)

The following example demonstrates how the Python output adapter reads data in a Sybase CEP stream.

from c8 import C8
# This is the URI to which we will try to connect.
uri = "ccl://localhost:6789/Stream/Default/Subscriber2/StreamOut1"
# Create a new Subscriber object.
subscriber = C8.Subscriber(uri)
# Minimize buffering (do this only for demo).
# This reduces performance, but makes sure that there 
# is not much delay before the output is visible.
subscriber.buf_size = 1
# Retrieve several rows.  
j = 1
while j <= 6:
tuple = subscriber.read_tuple()
print 'Sub Csv: ' + tuple.getcsv()
j = j + 1