- Navigation GuideYou are on a Command (operation) page with structural examples. Use the navigation breadcrumb if you would like to return to the Client landing page.
GetDatabasesCommand
Retrieves all databases defined in a given Data Catalog.
Example Syntax
Use a bare-bones client and the command you need to make an API call.
import { GlueClient, GetDatabasesCommand } from "@aws-sdk/client-glue"; // ES Modules import
// const { GlueClient, GetDatabasesCommand } = require("@aws-sdk/client-glue"); // CommonJS import
const client = new GlueClient(config);
const input = { // GetDatabasesRequest
CatalogId: "STRING_VALUE",
NextToken: "STRING_VALUE",
MaxResults: Number("int"),
ResourceShareType: "FOREIGN" || "ALL" || "FEDERATED",
AttributesToGet: [ // DatabaseAttributesList
"NAME",
],
};
const command = new GetDatabasesCommand(input);
const response = await client.send(command);
// { // GetDatabasesResponse
// DatabaseList: [ // DatabaseList // required
// { // Database
// Name: "STRING_VALUE", // required
// Description: "STRING_VALUE",
// LocationUri: "STRING_VALUE",
// Parameters: { // ParametersMap
// "<keys>": "STRING_VALUE",
// },
// CreateTime: new Date("TIMESTAMP"),
// CreateTableDefaultPermissions: [ // PrincipalPermissionsList
// { // PrincipalPermissions
// Principal: { // DataLakePrincipal
// DataLakePrincipalIdentifier: "STRING_VALUE",
// },
// Permissions: [ // PermissionList
// "ALL" || "SELECT" || "ALTER" || "DROP" || "DELETE" || "INSERT" || "CREATE_DATABASE" || "CREATE_TABLE" || "DATA_LOCATION_ACCESS",
// ],
// },
// ],
// TargetDatabase: { // DatabaseIdentifier
// CatalogId: "STRING_VALUE",
// DatabaseName: "STRING_VALUE",
// Region: "STRING_VALUE",
// },
// CatalogId: "STRING_VALUE",
// FederatedDatabase: { // FederatedDatabase
// Identifier: "STRING_VALUE",
// ConnectionName: "STRING_VALUE",
// },
// },
// ],
// NextToken: "STRING_VALUE",
// };
GetDatabasesCommand Input
Parameter | Type | Description |
---|
Parameter | Type | Description |
---|---|---|
AttributesToGet | DatabaseAttributes[] | undefined | Specifies the database fields returned by the |
CatalogId | string | undefined | The ID of the Data Catalog from which to retrieve |
MaxResults | number | undefined | The maximum number of databases to return in one response. |
NextToken | string | undefined | A continuation token, if this is a continuation call. |
ResourceShareType | ResourceShareType | undefined | Allows you to specify that you want to list the databases shared with your account. The allowable values are
|
GetDatabasesCommand Output
Parameter | Type | Description |
---|
Parameter | Type | Description |
---|---|---|
$metadata Required | ResponseMetadata | Metadata pertaining to this request. |
DatabaseList Required | Database[] | undefined | A list of |
NextToken | string | undefined | A continuation token for paginating the returned list of tokens, returned if the current segment of the list is not the last. |
Throws
Name | Fault | Details |
---|
Name | Fault | Details |
---|---|---|
EntityNotFoundException | client | A specified entity does not exist |
FederationSourceException | client | A federation source failed. |
FederationSourceRetryableException | client | A federation source failed, but the operation may be retried. |
GlueEncryptionException | client | An encryption operation failed. |
InternalServiceException | server | An internal service error occurred. |
InvalidInputException | client | The input provided was not valid. |
OperationTimeoutException | client | The operation timed out. |
GlueServiceException | Base exception class for all service exceptions from Glue service. |