Python Trove Client
raw JSON → 8.10.0 verified Fri May 01 auth: no python
Python-troveclient is the official OpenStack client library for interacting with the Trove (DBaaS) API. It provides both a Python API and a command-line interface for managing database instances, backups, configurations, and other database-as-a-service resources. Current version is 8.10.0, with a semi-regular release cadence aligned with OpenStack releases.
pip install python-troveclient Common errors
error ImportError: cannot import name 'client' from 'troveclient' ↓
cause Using wrong import path; old code uses 'from troveclient.v1 import client' which no longer exists.
fix
Replace with 'from troveclient import client'.
error troveclient.exceptions.NotFound: Database instance not found (HTTP 404) ↓
cause The requested instance ID does not exist or the user lacks permissions.
fix
Verify the instance ID and check that the user has appropriate role assignments in OpenStack.
error keystoneauth1.exceptions.http.Unauthorized: The request you have made requires authentication (HTTP 401) ↓
cause Invalid or expired Keystone credentials.
fix
Check OS_USERNAME, OS_PASSWORD, OS_AUTH_URL environment variables or re-authenticate with a valid token.
Warnings
breaking The client module moved from troveclient.v1.client to troveclient.client in version 3.0.0. Old imports will break. ↓
fix Use 'from troveclient import client' instead of 'from troveclient.v1 import client'.
breaking Support for the v1.0 API (troveclient.v1) was removed in version 5.0.0. Only the v1.1 API version is supported. ↓
fix Use API version '1' (for v1.1) when creating the client. Older API versions are no longer available.
gotcha python-troveclient requires 'python-keystoneclient' or 'keystoneauth1' for authentication. If only troveclient is installed, it will fail at runtime with ImportError. ↓
fix Install keystoneauth1 explicitly: 'pip install python-troveclient keystoneauth1'.
Imports
- client wrong
from troveclient.v1 import clientcorrectfrom troveclient import client
Quickstart
from troveclient import client
from keystoneauth1 import session
from keystoneauth1.identity import v3
auth = v3.Password(auth_url=os.environ.get('OS_AUTH_URL', 'http://localhost:5000/v3'),
username=os.environ.get('OS_USERNAME', 'admin'),
password=os.environ.get('OS_PASSWORD', 'admin'),
project_name=os.environ.get('OS_PROJECT_NAME', 'admin'),
user_domain_name='Default')
sess = session.Session(auth=auth)
trove = client.Client('1', session=sess)
instances = trove.instances.list()
print(instances)