Skip to main content

IBM Streams Database integration

Project description

Overview

Provides functions to run SQL statements to a database, for example IBM Db2 Warehouse.

This package exposes the com.ibm.streamsx.jdbc toolkit as Python methods for use with Streaming Analytics service on IBM Cloud and IBM Streams including IBM Cloud Pak for Data.

Sample

A simple example of a Streams application that creates a table, inserts a row and deletes the table:

from streamsx.topology.topology import *
from streamsx.topology.schema import CommonSchema, StreamSchema
from streamsx.topology.context import submit
import streamsx.database as db

topo = Topology()
sql_create = 'CREATE TABLE RUN_SAMPLE (A CHAR(10), B CHAR(10))'
sql_insert = 'INSERT INTO RUN_SAMPLE (A, B) VALUES (\'hello\', \'world\')'
sql_drop = 'DROP TABLE RUN_SAMPLE'
s = topo.source([sql_create, sql_insert, sql_drop]).as_string()
res_sql = db.run_statement(s, credentials)
res_sql.print()
submit('STREAMING_ANALYTICS_SERVICE', topo)
# Use for IBM Streams including IBM Cloud Private for Data
# submit ('DISTRIBUTED', topo)

Project details


Download files

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

Files for streamsx.database, version 1.4.0
Filename, size File type Python version Upload date Hashes
Filename, size streamsx.database-1.4.0-py2.py3-none-any.whl (13.6 kB) File type Wheel Python version 3.6 Upload date Hashes View hashes
Filename, size streamsx.database-1.4.0.tar.gz (6.7 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page