analyticdb_config.py 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. from typing import Optional
  2. from pydantic import Field, PositiveInt
  3. from pydantic_settings import BaseSettings
  4. class AnalyticdbConfig(BaseSettings):
  5. """
  6. Configuration for connecting to Alibaba Cloud AnalyticDB for PostgreSQL.
  7. Refer to the following documentation for details on obtaining credentials:
  8. https://www.alibabacloud.com/help/en/analyticdb-for-postgresql/getting-started/create-an-instance-instances-with-vector-engine-optimization-enabled
  9. """
  10. ANALYTICDB_KEY_ID: Optional[str] = Field(
  11. default=None, description="The Access Key ID provided by Alibaba Cloud for API authentication."
  12. )
  13. ANALYTICDB_KEY_SECRET: Optional[str] = Field(
  14. default=None, description="The Secret Access Key corresponding to the Access Key ID for secure API access."
  15. )
  16. ANALYTICDB_REGION_ID: Optional[str] = Field(
  17. default=None,
  18. description="The region where the AnalyticDB instance is deployed (e.g., 'cn-hangzhou', 'ap-southeast-1').",
  19. )
  20. ANALYTICDB_INSTANCE_ID: Optional[str] = Field(
  21. default=None,
  22. description="The unique identifier of the AnalyticDB instance you want to connect to.",
  23. )
  24. ANALYTICDB_ACCOUNT: Optional[str] = Field(
  25. default=None,
  26. description="The account name used to log in to the AnalyticDB instance"
  27. " (usually the initial account created with the instance).",
  28. )
  29. ANALYTICDB_PASSWORD: Optional[str] = Field(
  30. default=None, description="The password associated with the AnalyticDB account for database authentication."
  31. )
  32. ANALYTICDB_NAMESPACE: Optional[str] = Field(
  33. default=None, description="The namespace within AnalyticDB for schema isolation (if using namespace feature)."
  34. )
  35. ANALYTICDB_NAMESPACE_PASSWORD: Optional[str] = Field(
  36. default=None,
  37. description="The password for accessing the specified namespace within the AnalyticDB instance"
  38. " (if namespace feature is enabled).",
  39. )
  40. ANALYTICDB_HOST: Optional[str] = Field(
  41. default=None, description="The host of the AnalyticDB instance you want to connect to."
  42. )
  43. ANALYTICDB_PORT: PositiveInt = Field(
  44. default=5432, description="The port of the AnalyticDB instance you want to connect to."
  45. )
  46. ANALYTICDB_MIN_CONNECTION: PositiveInt = Field(default=1, description="Min connection of the AnalyticDB database.")
  47. ANALYTICDB_MAX_CONNECTION: PositiveInt = Field(default=5, description="Max connection of the AnalyticDB database.")