IBM流云对象存储集成

streamsx.objectstorage的Python项目详细描述


概述

提供将云对象存储中的对象作为流读取的函数。 提交元组以在云对象存储(cos)中创建对象。

此包将com.ibm.streamsx.objectstorage工具包公开为python方法,用于上的流分析服务 ibm cloud和ibm streams,包括ibmcloud-pak for data。

样品

streams应用程序向 一个物体。扫描cos上创建的对象并读取内容:

from streamsx.topology.topology import *
from streamsx.topology.schema import CommonSchema
from streamsx.topology.context import submit
import streamsx.objectstorage as cos

topo = Topology('ObjectStorageHelloWorld')

to_cos = topo.source(['Hello', 'World!'])
to_cos = to_cos.as_string()

# sample bucket with resiliency "regional" and location "us-south"
bucket = 'streamsx-py-sample'
# US-South region private endpoint
endpoint='s3.private.us-south.cloud-object-storage.appdomain.cloud'

# Write a stream to COS
cos.write(to_cos, bucket, endpoint, '/sample/hw%OBJECTNUM.txt')

scanned = cos.scan(topo, bucket=bucket, endpoint=endpoint, directory='/sample')

# read text file line by line
r = cos.read(scanned, bucket=bucket, endpoint=endpoint)

# print each line (tuple)
r.print()

submit('STREAMING_ANALYTICS_SERVICE', topo)
# Use for IBM Streams including IBM Cloud Pak for Data
# submit ('DISTRIBUTED', topo)

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java问题,包括来自非索引存储库的依赖关系   java lombok项目是否支持openjdk 11?   使用自定义摄像头的java在不同的安卓设备上会遇到很多问题   java如何在我的所有集成测试文件上执行beforeach   EclipseJava。lang.NoClassDefFoundError:org/java/plugin/ExtensionPoint   java Android陷入了从SQLite获取本周数据的困境   ClientResponseFilter中的java注入EJB   java读取Elasticsearch,Spark获取精确字段   java如何检查一个列表是否具有与另一个列表相同的元素,并且能够有重复的元素   java印地语文本验证按钮+selenium中的哪个   http如何使用Java发出多部分/formdata POST请求?   java在imageview上启动活动单击自定义阵列适配器   java如何根据表的第二列中的值设置第一列中的复选框?   javamysql与JDBC的连接