IBM流事件大集成
streamsx.eventstore的Python项目详细描述
概述
提供一个函数,用于将IBM流元组数据插入IBM DB2事件存储中的表中。
ibmdb2eventstore是一个内存数据库,用于在事件驱动应用程序中快速接收和分析流式数据。它为快速数据提供了结构,能够实时处理大量事件,并为高级分析和可操作的见解优化流式数据性能。
这个包将com.ibm.streamsx.eventstore工具箱和com.ibm.streamsx.jdbc工具箱公开为python方法。
支持的版本:
- DB2事件存储1.x:streamsx.event store版本1.x
- DB2事件存储2.x:streamsx.event store版本2.x
样品
streams应用程序向 DB2事件存储数据库中的表:
from streamsx.topology.topology import Topology from streamsx.topology.schema import CommonSchema, StreamSchema from streamsx.topology.context import submit from streamsx.topology.context import ContextTypes import streamsx.spl.toolkit import streamsx.eventstore as es topo = Topology('EventStoreSample') # provide connection endpoint information es_connection = 'HostIP:Port1;HostIP:Port2' # generate sample tuples with the schema of the target table s = topo.source([1,2,3,4,5,6,7,8,9]) schema=StreamSchema('tuple<int32 id, rstring name>').as_tuple() s = s.map(lambda x : (x,'X'+str(x*2)), schema=schema) # insert tuple data into table as rows res = es.insert(s, connection=es_connection, database='TESTDB', table='SampleTable', primary_key='id', partitioning_key='id') submit (ContextTypes.DISTRIBUTED, topo) # The Streams job is kept running.