BookmarkSubscribeRSS Feed
Rupasree
Obsidian | Level 7

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

1 REPLY 1
tylerfreckmann
SAS Employee

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 🙂

Whether you're already using SAS Event Stream Processing or thinking about it, this is where you can connect with your peers, ask questions and find resources.

 

Multiple Linear Regression in SAS

Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 4948 views
  • 1 like
  • 2 in conversation