<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to join Kafka input stream with big Oracle lookup table? in Streaming Analytics</title>
    <link>https://communities.sas.com/t5/Streaming-Analytics/How-to-join-Kafka-input-stream-with-big-Oracle-lookup-table/m-p/896165#M297</link>
    <description>&lt;P&gt;How many rows from ESP do you wish to join? How often does the Oracle table get updated? As a general rule I would copy the smaller table into the bigger table's environment.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 27 Sep 2023 21:13:23 GMT</pubDate>
    <dc:creator>SASKiwi</dc:creator>
    <dc:date>2023-09-27T21:13:23Z</dc:date>
    <item>
      <title>How to join Kafka input stream with big Oracle lookup table?</title>
      <link>https://communities.sas.com/t5/Streaming-Analytics/How-to-join-Kafka-input-stream-with-big-Oracle-lookup-table/m-p/896007#M296</link>
      <description>&lt;P&gt;Hi experts,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We have ESP 6.2 engine running and reading events from a Kafka topic. The incoming events need to be joined with a 5M row Oracle table for data enrichment.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Question is whether it is possible somehow to accomplish an efficient join in Oracle instead of pulling the 5M row Oracle table to an ESP window and then doing the join in ESP?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Eyal&lt;/P&gt;</description>
      <pubDate>Wed, 27 Sep 2023 08:45:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Streaming-Analytics/How-to-join-Kafka-input-stream-with-big-Oracle-lookup-table/m-p/896007#M296</guid>
      <dc:creator>EyalGonen</dc:creator>
      <dc:date>2023-09-27T08:45:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to join Kafka input stream with big Oracle lookup table?</title>
      <link>https://communities.sas.com/t5/Streaming-Analytics/How-to-join-Kafka-input-stream-with-big-Oracle-lookup-table/m-p/896165#M297</link>
      <description>&lt;P&gt;How many rows from ESP do you wish to join? How often does the Oracle table get updated? As a general rule I would copy the smaller table into the bigger table's environment.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Sep 2023 21:13:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Streaming-Analytics/How-to-join-Kafka-input-stream-with-big-Oracle-lookup-table/m-p/896165#M297</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2023-09-27T21:13:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to join Kafka input stream with big Oracle lookup table?</title>
      <link>https://communities.sas.com/t5/Streaming-Analytics/How-to-join-Kafka-input-stream-with-big-Oracle-lookup-table/m-p/896177#M298</link>
      <description>&lt;P&gt;Hi Eyal,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In 6.2, depending upon the performance level that you want, you can try calling SQL from Python or I think even from DS2 for querying in the DB itself. There may be a server level Lua support too but not sure which build of 6.2 you are in.&lt;/P&gt;
&lt;P&gt;Are you trying for a functionality to lookup certain entry in DB based on key from ESP events? If yes then it may be good to know that in ESP for Viya 4 we have two more ways to do that. One way is through a couple of dedicated windows called StateDB windows which can integrate with a fast in-memory DB like Redis to give pretty good performance for such operations. You can get more info about it here: &lt;A href="https://github.com/sassoftware/iot-sas-esp-integration-with-in-memory-databases" target="_blank"&gt;sassoftware/iot-sas-esp-integration-with-in-memory-databases: In this project, we present two new ESP StateDB windows StateDB Reader and StateDB Writer to integrate with Singelstore and Redis in-memory databases. (github.com)&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;Another is through Lua code which supports database calls about which you can find in the ESP documentation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Joydeep&lt;/P&gt;</description>
      <pubDate>Thu, 28 Sep 2023 02:08:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Streaming-Analytics/How-to-join-Kafka-input-stream-with-big-Oracle-lookup-table/m-p/896177#M298</guid>
      <dc:creator>jbhattacharya</dc:creator>
      <dc:date>2023-09-28T02:08:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to join Kafka input stream with big Oracle lookup table?</title>
      <link>https://communities.sas.com/t5/Streaming-Analytics/How-to-join-Kafka-input-stream-with-big-Oracle-lookup-table/m-p/896188#M299</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/178820"&gt;@jbhattacharya&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for the detailed reply. The join with the Oracle table is by a key from ESP field (from Kafka) and used to enrich the incoming event data with additional info and then this Oracle info is used to filter out some events and in some ESP additional logic. The Oracle is updated/refreshed once a day in the DBMS.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;Can you point me to an example on how to use Python/DS2 in an ESP window? Specifically, how can I use the input event field to inject an SQL into Oracle using its value?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 28 Sep 2023 06:20:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Streaming-Analytics/How-to-join-Kafka-input-stream-with-big-Oracle-lookup-table/m-p/896188#M299</guid>
      <dc:creator>EyalGonen</dc:creator>
      <dc:date>2023-09-28T06:20:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to join Kafka input stream with big Oracle lookup table?</title>
      <link>https://communities.sas.com/t5/Streaming-Analytics/How-to-join-Kafka-input-stream-with-big-Oracle-lookup-table/m-p/896578#M300</link>
      <description>&lt;P&gt;Hi Eyal,&lt;/P&gt;
&lt;P&gt;I am attaching an example with Python. To set your ESP to use Python you have to follow the documentation here:&amp;nbsp;&lt;A href="https://go.documentation.sas.com/doc/en/espcdc/6.2/espan/n1tsajfy4wmpypn1ohoit28tr0r8.htm" target="_blank"&gt;SAS Help Center: Overview&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;You will also need to install python modules related to Oracle which probably you can find here:&amp;nbsp;&lt;A href="https://www.geeksforgeeks.org/oracle-database-connection-in-python/" target="_blank"&gt;https://www.geeksforgeeks.org/oracle-database-connection-in-python/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In this sample I have used Postgres database as I have access to one but the idea is very much similar. For that I installed pycopg2 Python module in the vm where ESP is running. The attachments contain a sample ESP model and an external Python code that will be called. You can also embed the Python code inside the model. This model is developed quickly for a sample so it may not adhere to some of the best practices.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this is what you require.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Joydeep&lt;/P&gt;</description>
      <pubDate>Sun, 01 Oct 2023 03:01:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Streaming-Analytics/How-to-join-Kafka-input-stream-with-big-Oracle-lookup-table/m-p/896578#M300</guid>
      <dc:creator>jbhattacharya</dc:creator>
      <dc:date>2023-10-01T03:01:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to join Kafka input stream with big Oracle lookup table?</title>
      <link>https://communities.sas.com/t5/Streaming-Analytics/How-to-join-Kafka-input-stream-with-big-Oracle-lookup-table/m-p/896585#M301</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/178820"&gt;@jbhattacharya&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks! we are looking into your suggestion. In the meantime, quick question. Is it possible to have the embedded MAS (Python) maintain a pool of connections to the DB? In your example will Python open a new connection to the DB each time it is invoked by ESP?&lt;/P&gt;</description>
      <pubDate>Sun, 01 Oct 2023 11:52:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Streaming-Analytics/How-to-join-Kafka-input-stream-with-big-Oracle-lookup-table/m-p/896585#M301</guid>
      <dc:creator>EyalGonen</dc:creator>
      <dc:date>2023-10-01T11:52:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to join Kafka input stream with big Oracle lookup table?</title>
      <link>https://communities.sas.com/t5/Streaming-Analytics/How-to-join-Kafka-input-stream-with-big-Oracle-lookup-table/m-p/896599#M302</link>
      <description>&lt;P&gt;In the example only the function is called for each event. The other part of the code gets called only once I believe at the time of the model initialization.&lt;/P&gt;</description>
      <pubDate>Mon, 02 Oct 2023 01:31:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Streaming-Analytics/How-to-join-Kafka-input-stream-with-big-Oracle-lookup-table/m-p/896599#M302</guid>
      <dc:creator>jbhattacharya</dc:creator>
      <dc:date>2023-10-02T01:31:16Z</dc:date>
    </item>
  </channel>
</rss>

