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.2.0.tar.gz
(175.5 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file couchbase_connect_py-0.2.0.tar.gz.
File metadata
- Download URL: couchbase_connect_py-0.2.0.tar.gz
- Upload date:
- Size: 175.5 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9ba78c96adb5ef61701139583e90c9084e1e3408b8d8ef9a28b13c4fab0a0aa2
|
|
| MD5 |
7f84a584f2a03d177951886c14becb5c
|
|
| BLAKE2b-256 |
b709793dcf7396c77a881ce0bb8a654b121e1acaacfa32fa171921f6bdf8659d
|
File details
Details for the file couchbase_connect_py-0.2.0-py3-none-any.whl.
File metadata
- Download URL: couchbase_connect_py-0.2.0-py3-none-any.whl
- Upload date:
- Size: 62.2 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e99e643a15db4a9770d58df18421213929029f0645c0ceb1cafa96a540012f69
|
|
| MD5 |
2e198a0d1fe99192610c010f136e9100
|
|
| BLAKE2b-256 |
9270b81a3a30ab1b596215af8eca8e10f4fb2e502657791bd4471fd859ea8c22
|