Skip to main content

Couchbase Server and Capella connection helper with cluster, bucket, and index automation

Project description

couchbase-connect-py

Python helper for connecting to Couchbase Server or Capella through a unified interface, with cluster creation and bucket/scope/collection/index automation.

Install

pip install .

Quick start

from couchbase_connect import CouchbaseConfig, resolve

# Couchbase Server
config = (
    CouchbaseConfig()
    .host("127.0.0.1")
    .with_username("Administrator")
    .with_password("password")
    .ssl(False)
    .bucket("demo")
)
db = resolve(config)
db.connect(config)
db.create_bucket("demo", quota=128, replicas=0)
db.create_primary_index()
db.disconnect()

# Capella (when capella.token is set)
capella = (
    CouchbaseConfig()
    .token("...")
    .project("my-project")
    .database("my-cluster")
    .user_email("user@example.com")
    .with_username("dbuser")
    .with_password("dbpass")
)
db = resolve(capella)
db.connect(capella)

Context manager

from couchbase_connect import CouchbaseConfig, open_connection

with open_connection(config) as db:
    db.upsert("doc-1", {"hello": "world"})

Tests

# Unit tests
pytest -m "not server and not capella"

# Couchbase Server integration (Docker / testcontainers)
pytest -m server

# Capella integration (copy example property files under tests/resources/)
cp tests/resources/test.capella.2.properties.example tests/resources/test.capella.2.properties
# edit credentials, then:
pytest -m capella

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

couchbase_connect_py-0.4.0.tar.gz (179.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

couchbase_connect_py-0.4.0-py3-none-any.whl (63.7 kB view details)

Uploaded Python 3

File details

Details for the file couchbase_connect_py-0.4.0.tar.gz.

File metadata

  • Download URL: couchbase_connect_py-0.4.0.tar.gz
  • Upload date:
  • Size: 179.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Hatch/1.17.1 {"ci":null,"cpu":"arm64","distro":{"name":"macOS","version":"26.5.2"},"implementation":{"name":"CPython","version":"3.12.10"},"installer":{"name":"hatch","version":"1.17.1"},"openssl_version":"OpenSSL 3.0.16 11 Feb 2025","python":"3.12.10","system":{"name":"Darwin","release":"25.5.0"}} HTTPX2/2.7.0

File hashes

Hashes for couchbase_connect_py-0.4.0.tar.gz
Algorithm Hash digest
SHA256 15edbfa825b9fc020cf9056fa1664b3a25974cfdddc4908e968bfdbbe377db48
MD5 fff1294bb28d5cd3e9bdac8257d3ca7f
BLAKE2b-256 036babf804aab2dc7aff0a74818336dff6b998657035348b255d4b3baa33fa38

See more details on using hashes here.

File details

Details for the file couchbase_connect_py-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: couchbase_connect_py-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 63.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Hatch/1.17.1 {"ci":null,"cpu":"arm64","distro":{"name":"macOS","version":"26.5.2"},"implementation":{"name":"CPython","version":"3.12.10"},"installer":{"name":"hatch","version":"1.17.1"},"openssl_version":"OpenSSL 3.0.16 11 Feb 2025","python":"3.12.10","system":{"name":"Darwin","release":"25.5.0"}} HTTPX2/2.7.0

File hashes

Hashes for couchbase_connect_py-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3e3dbf2f8c9c3550505c67e58b631403012aec17b9a84205fe67bb827713880c
MD5 fffd3ea71154a5d5b00bcab933d098c0
BLAKE2b-256 6c4f8f87f12c4bb06ca69dc44644eed81774c5aec47969cc9f2adc50363f6071

See more details on using hashes here.

Supported by

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