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.5.0.tar.gz (181.8 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.5.0-py3-none-any.whl (64.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: couchbase_connect_py-0.5.0.tar.gz
  • Upload date:
  • Size: 181.8 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.5.0.tar.gz
Algorithm Hash digest
SHA256 14b7999cd9869a2f1ff81018c6ad45e18c6dd271342900dca5d628181db23958
MD5 2b5078c0f0d7eb6335f7aa44d8957576
BLAKE2b-256 6ab6d09ac5c799717388133f5cf100f75c31214583c6d9db2beb2e14b80bd910

See more details on using hashes here.

File details

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

File metadata

  • Download URL: couchbase_connect_py-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 64.9 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.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ae9c59a4a2e89e10b56dd44a69abb35f7c8a30079e6d87f9ec5020485ea5f9d0
MD5 44ea705d1084447fd9567ca79cc3bf06
BLAKE2b-256 5fa572656747bcea7f55362f550bf49855608019fe971e62b79a8d68a23aec47

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