Credential
- class couchbase_columnar.credential.Credential(**kwargs: str)
Create a Credential instance.
A Credential is required in order to connect to a Capalla Columnar server.
Important
Use the the provided classmethods to create a
Credential
instance.- classmethod from_username_and_password(username: str, password: str)
Create a
Credential
from a username and password.- Parameters:
- Return type:
- Returns:
A Credential instance.
- classmethod from_callable(callback: Callable[[], Credential])
Create a
Credential
from provided callback.The callback is
- Parameters:
callback (
Callable
[[],Credential
]) – Callback that returns aCredential
.- Return type:
- Returns:
A Credential instance.
Example
Retrieve credentials from environment variables:
def _cred_from_env() -> Credential: from os import getenv return Credential.from_username_and_password(getenv('PYCBCC_USERNAME'), getenv('PYCBCC_PW')) cred = Credential.from_callable(_cred_from_env)