SAS Data Integration Studio, DataFlux Data Management Studio, SAS/ACCESS, SAS Data Loader for Hadoop and others

Perform Simulations Using Python in SAS Event Stream Processing

Reply
Occasional Contributor
Posts: 9

Perform Simulations Using Python in SAS Event Stream Processing

Hi All,

 

I have a requirement where in I need to read the data from a csv file and push it into SAS Event Stream Processing.

For that I have written a python code which reads each row per 5 seconds and prints the data.

Now I need to push each row per 5 second to SAS Event Stream Processing.I am unable to figure out to how to achieve the same.

Your help and guidance is highly appreciated.

 

 

Thanks in advance

SAS Employee
Posts: 1

Re: Perform Simulations Using Python in SAS Event Stream Processing

You have a couple options here. You can read the csv directly into ESP using a file/socket connector or adapter. This example shows how to configure a csv connector in ESP Studio: CSV Connector with ESP Studio

 

If you are modeling in the XML layer then the csv connector would look something like this:

<connectors>
    <connector name="New_Connector_1" class="fs">
      <properties>
        <property name="type"><![CDATA[pub]]></property>
        <property name="fsname"><![CDATA[trades1M.csv]]></property>
        <property name="fstype"><![CDATA[csv]]></property>
        <property name="transactional"><![CDATA[true]]></property>
        <property name="blocksize"><![CDATA[1]]></property>
        <property name="dateformat"><![CDATA[%Y-%m-%d %H:%M:%S]]></property>
      </properties>
    </connector>

 

Additionally, you can open a socket and write to the socket from the Python program and have ESP listen to that socket. You would do this by defining fsname to be the address of the socket to listen to (for example, localhost:40000).

 

Finally, there is a Python publish/subscribe API with ESP 4.1 This would allow you to publish to ESP directly from the python program. I've attached a sample program to help you get started Smiley Happy

Ask a Question
Discussion stats
  • 1 reply
  • 3756 views
  • 1 like
  • 2 in conversation