Registry / aws / alibabacloud-adb20211201

alibabacloud-adb20211201

JSON →
library3.7.1pypypi✓ verified 49d ago

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.

awsdatabase
pip install alibabacloud-adb20211201
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
musl
py 3.103.930 runs
installs and imports cleanly · install 0.0s · import 1.858s · 58.1MB
glibc
py 3.103.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.
Debug
Known issues
breakingAlibaba Cloud SDKs are versioned by API dates (e.g., `adb20211201`). An update to this package (`pip install --upgrade alibabacloud-adb20211201`) will only update the client for the *20211201* API version. If new API features are released under a *newer API version* (e.g., `adb20240101`), you will need to install a *new, separate package* (e.g., `alibabacloud-adb20240101`), not just upgrade this one. This can lead to unexpected missing features if you expect all ADB features to be in a single continually updated package.
fix
Always check Alibaba Cloud's official documentation for the latest API versions and corresponding SDK packages. If newer features are desired, install the relevant new API-versioned SDK package.
affects: All versions
gotchaThe `config.endpoint` is a critical configuration parameter. Incorrectly setting or omitting the endpoint can lead to connection errors, requests being routed to the wrong region, or authentication failures. Each service and region typically has a specific endpoint.
fix
Always explicitly set `config.endpoint` to the correct value for your service and region. Refer to Alibaba Cloud's official documentation for the exact endpoint URLs. For example, `adb.cn-hangzhou.aliyuncs.com` for AnalyticDB in Hangzhou.
affects: All versions
gotchaAlibaba Cloud Python SDKs, especially those based on the Tea framework, require request parameters to be encapsulated within specific request model objects (e.g., `DescribeDBClusterAttributeRequest`), rather than being passed as simple dictionaries. Passing a dictionary where a model object is expected will result in type errors.
fix
Always instantiate the appropriate request model class (found in `alibabacloud_adb20211201.models`) and pass parameters as attributes to that object. For example, `request = DescribeDBClusterAttributeRequest(db_cluster_id='...')`.
affects: All versions
gotchaWhile a generic `try...except Exception as error` can catch errors, for robust applications, it's advisable to implement more specific error handling. Alibaba Cloud API errors often come with specific `code` and `message` attributes within the exception object (e.g., `error.code`, `error.message`), which can be parsed for detailed problem identification.
fix
Inspect the `error` object for `code` and `message` attributes to implement more granular error handling logic. Consult the ADB API documentation for a list of common error codes.
affects: All versions
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'alibabacloud_adb20211201'
The 'alibabacloud_adb20211201' package is not installed in the Python environment.
fix
pip install alibabacloud_adb20211201
ImportError: No module named 'Tea'
The 'Tea' module, a dependency of the SDK, is missing.
fix
pip install alibabacloud-tea
AttributeError: 'CredentialModel' object has no attribute 'provider_name'
An outdated 'alibabacloud_credentials' package is incompatible with the SDK.
fix
pip install --upgrade alibabacloud_credentials
ImportError: No module named 'pymysql'
The 'pymysql' package, required for database operations, is not installed.
fix
pip install pymysql
Tea.exceptions.UnretryableException: Invalid region or endpoint
The specified region does not support the requested service.
fix
Verify and specify a valid endpoint for the service in the region.
Upgrade
Version history
3.7.1latest on PyPI
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.
Agent activity
73 hits · last 30 days
node
8
petalbot
3
ahrefsbot
3
seranking-bot
2
Amazon
1
amazonbot
1
googlebot
1
Resources