Skip to main content

couchbase-helper: A simple helper package for Couchbase operations

pypi package downloads versions Tests coverage licence


Intro

While the Couchbase packages is easy enough to use, sometimes it also just requires some boilerplate code which becomes tiring to duplicate every time you need to perform simple document operations. At least, that's what I thought. So, I started creating a simple re-usable script which later became a class and ... well, here's Couchbase Helper!

Couchbase Helper is currently rather basic and mostly/only support the following operations fully:

  • insert
  • insert_multi
  • upsert
  • upsert_multi
  • replace
  • replace_multi
  • get
  • get_multi
  • remove
  • remove_multi

It currently also has very basic functionality for view queries (view_query) which isn't all that fancy. Follow issue #18 for updates on this.

An N1ql (SQL++) helper class is also available, which provides chainable methods to create SQL++ queries to select from indexes.

Installation

Installation is as you're used to, using your favorite package manager:

$ pip install couchbase-helper
... or
$ uv add couchbase-helper
... or
$ poetry add couchbase-helper
... and so on

Examples

Basic operations

from couchbase_helper import CouchbaseHelper, Session

# Connect to Couchbase server/cluster
session = Session(
    hostname="localhost",
    username="username",
    password="password",
    bucket="bucket",
    timeout=10,
)
cb = CouchbaseHelper(
    session=session,
)

# Insert document
document = {
    "foo": "bar"
}
cb.insert("foo1", document)

# Get document
document = cb.get("foo1")
print(document["foo"])  # bar

# Update document
document["hello"] = "world"
cb.upsert("foo1", document)

# Replace a document
new_document = {
    "bar": "baz"
}
cb.replace("foo1", new_document)

SQL++/N1QL examples

from couchbase_helper import Session
from couchbase_helper.n1ql import N1ql

# Connect to Couchbase server/cluster
session = Session(
    hostname="localhost",
    username="username",
    password="password",
    bucket="bucket",
    timeout=10,
)
session.connect()
n1ql = N1ql(session=session)

# Select documents where foo=bar
rows = n1ql.where("foo=", "bar").rows()
for row in rows:
    ...

# You can also select specific columns, from a different bucket , scope, or even collection than the session's:
rows = n1ql.select("callsign").from_("travel-sample", "inventory", "airport").where("city=", "San Jose").or_where("city=", "New York").rows()
for row in rows:
    ...

Metadata

Release files for couchbase-helper 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for couchbase-helper 0.1.4
File Size Uploaded
couchbase_helper-0.1.4.tar.gz 21.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for couchbase-helper 0.1.4
File Interpreter ABI Platform
couchbase_helper-0.1.4-py3-none-any.whl Python 3 none any Details

Total release size: 40.0 kB

Release files / couchbase_helper-0.1.4.tar.gz

Download URL couchbase_helper-0.1.4.tar.gz
Size 21.0 kB
Tags Source
SHA-256 checksum
How to use checksums
83a92988cbcad66da10f4bf1313495907b5c919d19ca586a49f2a77412bfe26c
BLAKE2b-256 checksum
How to use checksums
748d9d6b50449023969337ce4436e3fa4f117ddc019d41e6410acbb59552a9fd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 23, 2026.

Transparency log

Release files / couchbase_helper-0.1.4-py3-none-any.whl

Download URL couchbase_helper-0.1.4-py3-none-any.whl
Size 19.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
527fc16daab13f2e8a78c5eb81b1ce06d8170e2c26b6c62731c167afd91e460b
BLAKE2b-256 checksum
How to use checksums
57ef86d7ad021170b7101456664f54d9234994009d929850322c5d50737329b7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 23, 2026.

Transparency log

Release history Release notifications | RSS feed

0.1.5

2 release files

This release

0.1.4 This release

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page