{"id":1315,"library":"alibabacloud-adb20211201","title":"Alibaba Cloud ADB (AnalyticDB) SDK 20211201","description":"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.","status":"active","version":"3.7.1","language":"en","source_language":"en","source_url":"https://github.com/aliyun/alibabacloud-python-sdk","tags":["alibaba cloud","adb","analyticdb","database","sdk","cloud"],"install":[{"cmd":"pip install alibabacloud-adb20211201","lang":"bash","label":"Install via pip"}],"dependencies":[{"reason":"Required for core client configuration and models based on Alibaba Cloud's Tea framework.","package":"alibabacloud-tea-openapi"},{"reason":"Provides utility functions and runtime options used by the SDK clients.","package":"alibabacloud-tea-util"}],"imports":[{"symbol":"Client","correct":"from alibabacloud_adb20211201.client import Client"},{"note":"Ensure you import from the specific `adb20211201` package, not a generic `adb` or an older version package.","wrong":"from alibabacloud_adb.models import DescribeDBClusterAttributeRequest","symbol":"DescribeDBClusterAttributeRequest","correct":"from alibabacloud_adb20211201.models import DescribeDBClusterAttributeRequest"},{"note":"The core `Config` object comes from `alibabacloud-tea-openapi`, not the service-specific SDK package.","wrong":"from alibabacloud_adb20211201.models import Config","symbol":"Config","correct":"from alibabacloud_tea_openapi.models import Config"},{"note":"The `RuntimeOptions` class comes from `alibabacloud-tea-util`, not the service-specific SDK package.","wrong":"from alibabacloud_adb20211201.models import RuntimeOptions","symbol":"RuntimeOptions","correct":"from alibabacloud_tea_util.models import RuntimeOptions"}],"quickstart":{"code":"import os\nfrom alibabacloud_adb20211201.client import Client\nfrom alibabacloud_adb20211201.models import DescribeDBClusterAttributeRequest\nfrom alibabacloud_tea_openapi.models import Config\nfrom alibabacloud_tea_util.models import RuntimeOptions\n\n# Configure AccessKey ID and Secret from environment variables\nconfig = Config(\n    access_key_id=os.environ.get('ALIBABA_CLOUD_ACCESS_KEY_ID', ''),\n    access_key_secret=os.environ.get('ALIBABA_CLOUD_ACCESS_KEY_SECRET', '')\n)\n\n# IMPORTANT: Configure the correct endpoint for your region and service.\n# Replace 'cn-hangzhou' with your actual region.\nconfig.endpoint = 'adb.cn-hangzhou.aliyuncs.com'\n\n# Initialize the ADB client\nclient = Client(config)\n\n# Example: Describe a DB Cluster Attribute\n# Replace 'am-xxxxxxxxx' with an actual ADB cluster ID\nrequest = DescribeDBClusterAttributeRequest(\n    db_cluster_id='am-testclusterid'\n)\n\nruntime = RuntimeOptions()\ntry:\n    # Make the API call\n    response = client.describe_dbcluster_attribute_with_options(request, runtime)\n    print(\"Successfully described DB Cluster attribute:\")\n    print(response.body.to_map())\nexcept Exception as error:\n    print(f\"An error occurred: {error}\")\n    # In a production environment, parse 'error.code' and 'error.message'\n    # for more specific error handling.","lang":"python","description":"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."},"warnings":[{"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.","message":"Alibaba 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.","severity":"breaking","affected_versions":"All versions"},{"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.","message":"The `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.","severity":"gotcha","affected_versions":"All versions"},{"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='...')`.","message":"Alibaba 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.","severity":"gotcha","affected_versions":"All versions"},{"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.","message":"While 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.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-09T00:00:00.000Z","next_check":"2026-07-08T00:00:00.000Z"}