Skip to content

IBM DB2

Bases: Spout

__init__(output, state, **kwargs)

Initialize the DB2 class.

Parameters:

Name Type Description Default
output BatchOutput

An instance of the BatchOutput class for saving the data.

required
state State

An instance of the State class for maintaining the state.

required
**kwargs

Additional keyword arguments.

{}

Using geniusrise to invoke via command line

genius DB2 rise \
    batch \
        --output_s3_bucket my_bucket \
        --output_s3_folder s3/folder \
    none \
    fetch \
        --args hostname=mydb2.example.com port=50000 username=myusername password=mypassword database=mydb

Using geniusrise to invoke via YAML file

version: "1"
spouts:
    my_db2_spout:
        name: "DB2"
        method: "fetch"
        args:
            hostname: "mydb2.example.com"
            port: 50000
            username: "myusername"
            password: "mypassword"
            database: "mydb"
        output:
            type: "batch"
            args:
                bucket: "my_bucket"
                s3_folder: "s3/folder"

fetch(hostname, port, username, password, database)

📖 Fetch data from a DB2 database and save it in batch.

Parameters:

Name Type Description Default
hostname str

The DB2 hostname.

required
port int

The DB2 port.

required
username str

The DB2 username.

required
password str

The DB2 password.

required
database str

The DB2 database name.

required

Raises:

Type Description
Exception

If unable to connect to the DB2 server or execute the command.