list_databases
¶
list_databases(
*,
config_overrides: Optional[RedshiftDataClientConfig] = None,
cluster_identifier: Optional[ClusterIdentifierString] = None,
database: Optional[String] = None,
secret_arn: Optional[SecretArn] = None,
db_user: Optional[String] = None,
next_token: Optional[String] = None,
max_results: Optional[PageSize] = None,
workgroup_name: Optional[WorkgroupNameString] = None,
) -> ListDatabasesResponse
List the databases in a cluster. A token is returned to page through the database list. Depending on the authorization method, use one of the following combinations of request parameters:
-
Secrets Manager - when connecting to a cluster, provide the
secret-arnof a secret stored in Secrets Manager which hasusernameandpassword. The specified secret contains credentials to connect to thedatabaseyou specify. When you are connecting to a cluster, you also supply the database name, If you provide a cluster identifier (dbClusterIdentifier), it must match the cluster identifier stored in the secret. When you are connecting to a serverless workgroup, you also supply the database name. -
Temporary credentials - when connecting to your data warehouse, choose one of the following options:
-
When connecting to a serverless workgroup, specify the workgroup name and database name. The database user name is derived from the IAM identity. For example,
arn:iam::123456789012:user:foohas the database user nameIAM:foo. Also, permission to call theredshift-serverless:GetCredentialsoperation is required. -
When connecting to a cluster as an IAM identity, specify the cluster identifier and the database name. The database user name is derived from the IAM identity. For example,
arn:iam::123456789012:user:foohas the database user nameIAM:foo. Also, permission to call theredshift:GetClusterCredentialsWithIAMoperation is required. -
When connecting to a cluster as a database user, specify the cluster identifier, the database name, and the database user name. Also, permission to call the
redshift:GetClusterCredentialsoperation is required.
-
For more information about the Amazon Redshift Data API and CLI usage examples, see Using the Amazon Redshift Data API in the Amazon Redshift Management Guide.
Parameters:
-
cluster_identifier(Optional[ClusterIdentifierString], default:None) –The cluster identifier. This parameter is required when connecting to a cluster and authenticating using either Secrets Manager or temporary credentials.
-
database(Optional[String], default:None) –The name of the database. This parameter is required when authenticating using either Secrets Manager or temporary credentials.
-
secret_arn(Optional[SecretArn], default:None) –The name or ARN of the secret that enables access to the database. This parameter is required when authenticating using Secrets Manager.
-
db_user(Optional[String], default:None) –The database user name. This parameter is required when connecting to a cluster as a database user and authenticating using temporary credentials.
-
next_token(Optional[String], default:None) –A value that indicates the starting point for the next set of response records in a subsequent request. If a value is returned in a response, you can retrieve the next set of records by providing this returned NextToken value in the next NextToken parameter and retrying the command. If the NextToken field is empty, all response records have been retrieved for the request.
-
max_results(Optional[PageSize], default:None) –The maximum number of databases to return in the response. If more databases exist than fit in one response, then
NextTokenis returned to page through the results. -
workgroup_name(Optional[WorkgroupNameString], default:None) –The serverless workgroup name or Amazon Resource Name (ARN). This parameter is required when connecting to a serverless workgroup and authenticating using either Secrets Manager or temporary credentials.
Raises:
-
DatabaseConnectionException–Connection to a database failed.
-
InternalServerException–The Amazon Redshift Data API operation failed due to invalid input.
-
QueryTimeoutException–The Amazon Redshift Data API operation failed due to timeout.
-
ResourceNotFoundException–The Amazon Redshift Data API operation failed due to a missing resource.
-
ValidationException–The Amazon Redshift Data API operation failed due to invalid input.
-
UnknownServiceError–The service returned an error code this client does not model.
Source code in docs_src/capo_redshift_data/_services/redshift_data.py
839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 | |