Amazon Redshift will no longer support the creation of new Python UDFs starting November 1, 2025.
If you would like to use Python UDFs, create the UDFs prior to that date.
Existing Python UDFs will continue to function as normal. For more information, see the
blog post
Use ListDatabases with an AWS SDK
The following code examples show how to use ListDatabases.
- .NET
-
- SDK for .NET (v4)
-
Note
There's more on GitHub. Find the complete example and learn how to set up and run in the AWS Code Examples Repository
. /// <summary> /// List databases in a Redshift cluster. /// </summary> /// <param name="clusterIdentifier">The cluster identifier.</param> /// <param name="dbUser">The database user.</param> /// <param name="dbUser">The database name for authentication.</param> /// <returns>A list of database names.</returns> public async Task<List<string>> ListDatabasesAsync(string clusterIdentifier, string dbUser, string databaseName) { try { var request = new ListDatabasesRequest { ClusterIdentifier = clusterIdentifier, DbUser = dbUser, Database = databaseName }; var response = await _redshiftDataClient.ListDatabasesAsync(request); var databases = new List<string>(); foreach (var database in response.Databases) { Console.WriteLine($"The database name is : {database}"); databases.Add(database); } return databases; } catch (Amazon.RedshiftDataAPIService.Model.ValidationException ex) { Console.WriteLine($"Validation error: {ex.Message}"); throw; } catch (Exception ex) { Console.WriteLine($"Couldn't list databases. Here's why: {ex.Message}"); throw; } }-
For API details, see ListDatabases in AWS SDK for .NET API Reference.
-
- Java
-
- SDK for Java 2.x
-
Note
There's more on GitHub. Find the complete example and learn how to set up and run in the AWS Code Examples Repository
. /** * Lists all databases asynchronously for the specified cluster, database user, and database. * @param clusterId the identifier of the cluster to list databases for * @param dbUser the database user to use for the list databases request * @param database the database to list databases for * @return a {@link CompletableFuture} that completes when the database listing is complete, or throws a {@link RuntimeException} if there was an error */ public CompletableFuture<Void> listAllDatabasesAsync(String clusterId, String dbUser, String database) { ListDatabasesRequest databasesRequest = ListDatabasesRequest.builder() .clusterIdentifier(clusterId) .dbUser(dbUser) .database(database) .build(); // Asynchronous paginator for listing databases. ListDatabasesPublisher databasesPaginator = getAsyncDataClient().listDatabasesPaginator(databasesRequest); CompletableFuture<Void> future = databasesPaginator.subscribe(response -> { response.databases().forEach(db -> { logger.info("The database name is {} ", db); }); }); // Return the future for asynchronous handling. return future.exceptionally(exception -> { throw new RuntimeException("Failed to list databases: " + exception.getMessage(), exception); }); }-
For API details, see ListDatabases in AWS SDK for Java 2.x API Reference.
-
For a complete list of AWS SDK developer guides and code examples, see Using this service with an AWS SDK. This topic also includes information about getting started and details about previous SDK versions.