Registry /
aws / alibabacloud-adb20211201
The `alibabacloud-adb20211201` library, currently at version 3.7.1, provides the official Python SDK for interacting with Alibaba Cloud AnalyticDB (ADB) services. It allows developers to programmatically manage ADB clusters, databases, and execute various ADB operations. Alibaba Cloud SDKs are typically updated frequently to reflect the latest API changes for their respective services and API versions.
Install & Compatibility
Where this runs
tested against v3.7.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.930 runs
installs and imports cleanly · install 0.0s · import 1.858s · 58.1MB
glibcpy 3.10–3.930 runs
installs and imports cleanly · install 8.9s · import 1.687s · 60MB
59MB installed
● package 59MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
Client
✓ from alibabacloud_adb20211201.client import Client
DescribeDBClusterAttributeRequest
✓ from alibabacloud_adb20211201.models import DescribeDBClusterAttributeRequest
✗ from alibabacloud_adb.models import DescribeDBClusterAttributeRequest
Ensure you import from the specific `adb20211201` package, not a generic `adb` or an older version package.
Config
✓ from alibabacloud_tea_openapi.models import Config
✗ from alibabacloud_adb20211201.models import Config
The core `Config` object comes from `alibabacloud-tea-openapi`, not the service-specific SDK package.
RuntimeOptions
✓ from alibabacloud_tea_util.models import RuntimeOptions
✗ from alibabacloud_adb20211201.models import RuntimeOptions
The `RuntimeOptions` class comes from `alibabacloud-tea-util`, not the service-specific SDK package.
This quickstart demonstrates how to initialize the `adb20211201` client, configure it with credentials and an endpoint, and then make a basic API call (describing a DB Cluster's attributes). Ensure your `ALIBABA_CLOUD_ACCESS_KEY_ID` and `ALIBABA_CLOUD_ACCESS_KEY_SECRET` environment variables are set, and replace the placeholder `db_cluster_id` and `cn-hangzhou` with your actual values.
import os
from alibabacloud_adb20211201.client import Client
from alibabacloud_adb20211201.models import DescribeDBClusterAttributeRequest
from alibabacloud_tea_openapi.models import Config
from alibabacloud_tea_util.models import RuntimeOptions
# Configure AccessKey ID and Secret from environment variables
config = Config(
access_key_id=os.environ.get('ALIBABA_CLOUD_ACCESS_KEY_ID', ''),
access_key_secret=os.environ.get('ALIBABA_CLOUD_ACCESS_KEY_SECRET', '')
)
# IMPORTANT: Configure the correct endpoint for your region and service.
# Replace 'cn-hangzhou' with your actual region.
config.endpoint = 'adb.cn-hangzhou.aliyuncs.com'
# Initialize the ADB client
client = Client(config)
# Example: Describe a DB Cluster Attribute
# Replace 'am-xxxxxxxxx' with an actual ADB cluster ID
request = DescribeDBClusterAttributeRequest(
db_cluster_id='am-testclusterid'
)
runtime = RuntimeOptions()
try:
# Make the API call
response = client.describe_dbcluster_attribute_with_options(request, runtime)
print("Successfully described DB Cluster attribute:")
print(response.body.to_map())
except Exception as error:
print(f"An error occurred: {error}")
# In a production environment, parse 'error.code' and 'error.message'
# for more specific error handling.
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'alibabacloud_adb20211201'
The 'alibabacloud_adb20211201' package is not installed in the Python environment.
fixpip install alibabacloud_adb20211201
ImportError: No module named 'Tea'
The 'Tea' module, a dependency of the SDK, is missing.
fixpip install alibabacloud-tea
AttributeError: 'CredentialModel' object has no attribute 'provider_name'
An outdated 'alibabacloud_credentials' package is incompatible with the SDK.
fixpip install --upgrade alibabacloud_credentials
ImportError: No module named 'pymysql'
The 'pymysql' package, required for database operations, is not installed.
Tea.exceptions.UnretryableException: Invalid region or endpoint
The specified region does not support the requested service.
fixVerify and specify a valid endpoint for the service in the region.
Audit
Dependencies
alibabacloud-tea-openapirequiredRequired for core client configuration and models based on Alibaba Cloud's Tea framework.
alibabacloud-tea-utilrequiredProvides utility functions and runtime options used by the SDK clients.