Skip to content

Couchbase

Bases: Spout

__init__(output, state, **kwargs)

Initialize the CouchbaseSpout 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 Any

Additional keyword arguments.

{}

Using geniusrise to invoke via command line

genius CouchbaseSpout rise \
    batch \
        --output_s3_bucket my_bucket \
        --output_s3_folder s3/folder \
    none \
    fetch \
        --args host=localhost username=admin password=password bucket_name=my_bucket query="SELECT * FROM my_bucket" page_size=100

Using geniusrise to invoke via YAML file

version: "1"
spouts:
    my_couchbase_spout:
        name: "CouchbaseSpout"
        method: "fetch"
        args:
            host: "localhost"
            username: "admin"
            password: "password"
            bucket_name: "my_bucket"
            query: "SELECT * FROM my_bucket"
            page_size: 100
        output:
            type: "batch"
            args:
                bucket: "my_bucket"
                s3_folder: "s3/folder"

fetch(host, username, password, bucket_name, query, page_size=100)

📖 Fetch data from a Couchbase bucket and save it in batch.

Parameters:

Name Type Description Default
host str

The Couchbase host.

required
username str

The Couchbase username.

required
password str

The Couchbase password.

required
bucket_name str

The Couchbase bucket name.

required
query str

The N1QL query to execute.

required
page_size int

The number of documents to fetch per page. Defaults to 100.

100

Raises:

Type Description
Exception

If unable to connect to the Couchbase cluster or execute the query.