Skip to main content

IBM Streams Cloud Object Storage integration

Project description

Overview

Provides functions to read objects from Cloud Object Storage as a stream and submit tuples to create objects in Cloud Object Storage (COS).

IBM Cloud Object Storage makes it possible to store practically limitless amounts of data, simply and cost effectively. It is commonly used for data archiving and backup, web and mobile applications, and as scalable, persistent storage for analytics.

Sample

A simple hello world example of a Streams application writing string messages to an object. Scan for created object on COS and read the content:

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()

# Write a stream to COS using streamsx-py-sample bucket
cos.write(to_cos, bucket='streamsx-py-sample', objectName='/sample/hw%OBJECTNUM.txt')

scanned = cos.scan(topo, bucket='streamsx-py-sample', directory='/sample')

# read text file line by line
r = cos.read(scanned, bucket='streamsx-py-sample')

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

submit('STREAMING_ANALYTICS_SERVICE', topo)

Documentation

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

streamsx.objectstorage-0.2.1.tar.gz (4.5 kB view hashes)

Uploaded Source

Built Distribution

streamsx.objectstorage-0.2.1-py2.py3-none-any.whl (11.5 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page