This release is a pre-release and may not be stable for production use.
Couchbase Python Operational Insights Client
Python client for Couchbase Operational Insights.
Python 3.10+ is supported.
Note: The SDK uses ijson to stream query results. On a Python release newer than the ones ijson publishes wheels for, ijson installs from source and, unless the yajl 2 library is present when it is built, uses its pure-Python parser. The SDK still works, but parsing large results is slower. The SDK logs which ijson backend it is using when it creates its HTTP client, as a warning if it is the pure-Python one. To get the C backend, install yajl 2 (e.g.
libyajl-devon Debian/Ubuntu,yajlon Homebrew) and reinstall the SDK with ijson built from source:python3 -m pip install --force-reinstall --no-binary ijson couchbase-operational-insights.
The Operational Insights SDK supports static typing. Currently only mypy is supported. You mileage may vary (YMMV) with the use of other static type checkers (e.g. pyright).
Installing the SDK
Note: It is strongly recommended to update pip, setuptools and wheel prior to installing the SDK:
python3 -m pip install --upgrade pip setuptools wheel
Install the SDK via pip:
python3 -m pip install couchbase-operational-insights
Installing the SDK from source
The SDK can be installed from source via pip with the following command.
Install the SDK via pip:
python3 -m pip install git+https://github.com/couchbase/operational-insights-python-client.git
Using the SDK
Some more examples are provided in the examples directory.
Connecting and executing a query
from couchbase_operational_insights.cluster import Cluster
from couchbase_operational_insights.credential import Credential
from couchbase_operational_insights.options import QueryOptions
def main() -> None:
# Update this to your cluster
# IMPORTANT: The appropriate port needs to be specified. The SDK's default ports are 80 (http) and 443 (https).
# If attempting to connect to Capella, the correct ports are most likely to be 8095 (http) and 18095 (https).
# Capella example: https://cb.2xg3vwszqgqcrsix.cloud.couchbase.com:18095
endpoint = 'https://--your-instance--'
username = 'username'
pw = 'password'
# User Input ends here.
cred = Credential.from_username_and_password(username, pw)
cluster = Cluster.create_instance(endpoint, cred)
# Execute a query and buffer all result rows in client memory.
statement = 'SELECT * FROM `travel-sample`.inventory.airline LIMIT 10;'
res = cluster.execute_query(statement)
all_rows = res.get_all_rows()
for row in all_rows:
print(f'Found row: {row}')
print(f'metadata={res.metadata()}')
# Execute a query and process rows as they arrive from server.
statement = 'SELECT * FROM `travel-sample`.inventory.airline WHERE country="United States" LIMIT 10;'
res = cluster.execute_query(statement)
for row in res.rows():
print(f'Found row: {row}')
print(f'metadata={res.metadata()}')
# Execute a streaming query with positional arguments.
statement = 'SELECT * FROM `travel-sample`.inventory.airline WHERE country=$1 LIMIT $2;'
res = cluster.execute_query(statement, QueryOptions(positional_parameters=['United States', 10]))
for row in res:
print(f'Found row: {row}')
print(f'metadata={res.metadata()}')
# Execute a streaming query with named arguments.
statement = 'SELECT * FROM `travel-sample`.inventory.airline WHERE country=$country LIMIT $limit;'
res = cluster.execute_query(statement, QueryOptions(named_parameters={'country': 'United States',
'limit': 10}))
for row in res.rows():
print(f'Found row: {row}')
print(f'metadata={res.metadata()}')
if __name__ == '__main__':
main()
Using the async API
import asyncio
from acouchbase_operational_insights.cluster import AsyncCluster
from acouchbase_operational_insights.credential import Credential
from acouchbase_operational_insights.options import QueryOptions
async def main() -> None:
# Update this to your cluster
# IMPORTANT: The appropriate port needs to be specified. The SDK's default ports are 80 (http) and 443 (https).
# If attempting to connect to Capella, the correct ports are most likely to be 8095 (http) and 18095 (https).
# Capella example: https://cb.2xg3vwszqgqcrsix.cloud.couchbase.com:18095
endpoint = 'https://--your-instance--'
username = 'username'
pw = 'password'
# User Input ends here.
cred = Credential.from_username_and_password(username, pw)
cluster = AsyncCluster.create_instance(endpoint, cred)
# Execute a query and buffer all result rows in client memory.
statement = 'SELECT * FROM `travel-sample`.inventory.airline LIMIT 10;'
res = await cluster.execute_query(statement)
all_rows = await res.get_all_rows()
# NOTE: all_rows is a list, _do not_ use `async for`
for row in all_rows:
print(f'Found row: {row}')
print(f'metadata={res.metadata()}')
# Execute a query and process rows as they arrive from server.
statement = 'SELECT * FROM `travel-sample`.inventory.airline WHERE country="United States" LIMIT 10;'
res = await cluster.execute_query(statement)
async for row in res.rows():
print(f'Found row: {row}')
print(f'metadata={res.metadata()}')
# Execute a streaming query with positional arguments.
statement = 'SELECT * FROM `travel-sample`.inventory.airline WHERE country=$1 LIMIT $2;'
res = await cluster.execute_query(statement, QueryOptions(positional_parameters=['United States', 10]))
async for row in res:
print(f'Found row: {row}')
print(f'metadata={res.metadata()}')
# Execute a streaming query with named arguments.
statement = 'SELECT * FROM `travel-sample`.inventory.airline WHERE country=$country LIMIT $limit;'
res = await cluster.execute_query(statement, QueryOptions(named_parameters={'country': 'United States',
'limit': 10}))
async for row in res.rows():
print(f'Found row: {row}')
print(f'metadata={res.metadata()}')
if __name__ == '__main__':
asyncio.run(main())
Metadata
Release files for couchbase-operational-insights 1.0.0rc1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| couchbase_operational_insights-1.0.0rc1.tar.gz | 88.0 kB | With provenance | Details for couchbase_operational_insights-1.0.0rc1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| couchbase_operational_insights-1.0.0rc1-py3-none-any.whl | Python 3 | none | any | Details for couchbase_operational_insights-1.0.0rc1-py3-none-any.whl |
Total release size: 241.6 kB
Release files / couchbase_operational_insights-1.0.0rc1.tar.gz
| Download URL | couchbase_operational_insights-1.0.0rc1.tar.gz |
|---|---|
| Size | 88.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
71458411f36e90ff86b4d4c0902447ff59ae05965b346140975c4ca8e0893a32
|
|
BLAKE2b-256 checksum How to use checksums |
306c3bff83a9cdef2f066a63013e04f762e36d74f4716289fc4a9395329dcb99
|
| 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 Oct 14, 2026.
Transparency logRelease files / couchbase_operational_insights-1.0.0rc1-py3-none-any.whl
| Download URL | couchbase_operational_insights-1.0.0rc1-py3-none-any.whl |
|---|---|
| Size | 153.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2b38551bb33f5adcf09c37de7c2fedc37499baced6e74a85597ed25ad13e245d
|
|
BLAKE2b-256 checksum How to use checksums |
7dc95c34fb468683f22bb4bc327b445a27a62975d98ccb1092bc3bca6bcdf1da
|
| 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 Oct 14, 2026.
Transparency logSecurity for couchbase-operational-insights 1.0.0rc1
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.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for couchbase_operational_insights-1.0.0rc1.tar.gz
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 Oct 14, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.