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.3.0.tar.gz
(179.0 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.3.0.tar.gz.
File metadata
- Download URL: couchbase_connect_py-0.3.0.tar.gz
- Upload date:
- Size: 179.0 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 |
f08e01b9f256249b596cad59df8c15263fbda7b5c035211e3e3312ea7309288f
|
|
| MD5 |
fe2a5af6b8b73fa09a196e9c61d8a1ab
|
|
| BLAKE2b-256 |
d04854eb67916d9f30712c064097eca9c01dda3b310224f1d71d04adb3125941
|
File details
Details for the file couchbase_connect_py-0.3.0-py3-none-any.whl.
File metadata
- Download URL: couchbase_connect_py-0.3.0-py3-none-any.whl
- Upload date:
- Size: 63.0 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 |
03af57192a8d1e776a02835dc1f1731061498ffd48409a91e799de0768f5e498
|
|
| MD5 |
5ad4f806ca21971df4045c67de9f87f0
|
|
| BLAKE2b-256 |
8cc0d5d25c45585506ed3f6152e0b0645692a54257c8464b34a3dffdc9155501
|