GetTableCommand

Retrieves the Table definition in a Data Catalog for a specified table.

Example Syntax

Use a bare-bones client and the command you need to make an API call.

import { GlueClient, GetTableCommand } from "@aws-sdk/client-glue"; // ES Modules import
// const { GlueClient, GetTableCommand } = require("@aws-sdk/client-glue"); // CommonJS import
const client = new GlueClient(config);
const input = { // GetTableRequest
  CatalogId: "STRING_VALUE",
  DatabaseName: "STRING_VALUE", // required
  Name: "STRING_VALUE", // required
  TransactionId: "STRING_VALUE",
  QueryAsOfTime: new Date("TIMESTAMP"),
  IncludeStatusDetails: true || false,
};
const command = new GetTableCommand(input);
const response = await client.send(command);
// { // GetTableResponse
//   Table: { // Table
//     Name: "STRING_VALUE", // required
//     DatabaseName: "STRING_VALUE",
//     Description: "STRING_VALUE",
//     Owner: "STRING_VALUE",
//     CreateTime: new Date("TIMESTAMP"),
//     UpdateTime: new Date("TIMESTAMP"),
//     LastAccessTime: new Date("TIMESTAMP"),
//     LastAnalyzedTime: new Date("TIMESTAMP"),
//     Retention: Number("int"),
//     StorageDescriptor: { // StorageDescriptor
//       Columns: [ // ColumnList
//         { // Column
//           Name: "STRING_VALUE", // required
//           Type: "STRING_VALUE",
//           Comment: "STRING_VALUE",
//           Parameters: { // ParametersMap
//             "<keys>": "STRING_VALUE",
//           },
//         },
//       ],
//       Location: "STRING_VALUE",
//       AdditionalLocations: [ // LocationStringList
//         "STRING_VALUE",
//       ],
//       InputFormat: "STRING_VALUE",
//       OutputFormat: "STRING_VALUE",
//       Compressed: true || false,
//       NumberOfBuckets: Number("int"),
//       SerdeInfo: { // SerDeInfo
//         Name: "STRING_VALUE",
//         SerializationLibrary: "STRING_VALUE",
//         Parameters: {
//           "<keys>": "STRING_VALUE",
//         },
//       },
//       BucketColumns: [ // NameStringList
//         "STRING_VALUE",
//       ],
//       SortColumns: [ // OrderList
//         { // Order
//           Column: "STRING_VALUE", // required
//           SortOrder: Number("int"), // required
//         },
//       ],
//       Parameters: "<ParametersMap>",
//       SkewedInfo: { // SkewedInfo
//         SkewedColumnNames: [
//           "STRING_VALUE",
//         ],
//         SkewedColumnValues: [ // ColumnValueStringList
//           "STRING_VALUE",
//         ],
//         SkewedColumnValueLocationMaps: { // LocationMap
//           "<keys>": "STRING_VALUE",
//         },
//       },
//       StoredAsSubDirectories: true || false,
//       SchemaReference: { // SchemaReference
//         SchemaId: { // SchemaId
//           SchemaArn: "STRING_VALUE",
//           SchemaName: "STRING_VALUE",
//           RegistryName: "STRING_VALUE",
//         },
//         SchemaVersionId: "STRING_VALUE",
//         SchemaVersionNumber: Number("long"),
//       },
//     },
//     PartitionKeys: [
//       {
//         Name: "STRING_VALUE", // required
//         Type: "STRING_VALUE",
//         Comment: "STRING_VALUE",
//         Parameters: "<ParametersMap>",
//       },
//     ],
//     ViewOriginalText: "STRING_VALUE",
//     ViewExpandedText: "STRING_VALUE",
//     TableType: "STRING_VALUE",
//     Parameters: "<ParametersMap>",
//     CreatedBy: "STRING_VALUE",
//     IsRegisteredWithLakeFormation: true || false,
//     TargetTable: { // TableIdentifier
//       CatalogId: "STRING_VALUE",
//       DatabaseName: "STRING_VALUE",
//       Name: "STRING_VALUE",
//       Region: "STRING_VALUE",
//     },
//     CatalogId: "STRING_VALUE",
//     VersionId: "STRING_VALUE",
//     FederatedTable: { // FederatedTable
//       Identifier: "STRING_VALUE",
//       DatabaseIdentifier: "STRING_VALUE",
//       ConnectionName: "STRING_VALUE",
//     },
//     ViewDefinition: { // ViewDefinition
//       IsProtected: true || false,
//       Definer: "STRING_VALUE",
//       SubObjects: [ // ViewSubObjectsList
//         "STRING_VALUE",
//       ],
//       Representations: [ // ViewRepresentationList
//         { // ViewRepresentation
//           Dialect: "REDSHIFT" || "ATHENA" || "SPARK",
//           DialectVersion: "STRING_VALUE",
//           ViewOriginalText: "STRING_VALUE",
//           ViewExpandedText: "STRING_VALUE",
//           ValidationConnection: "STRING_VALUE",
//           IsStale: true || false,
//         },
//       ],
//     },
//     IsMultiDialectView: true || false,
//     Status: { // TableStatus
//       RequestedBy: "STRING_VALUE",
//       UpdatedBy: "STRING_VALUE",
//       RequestTime: new Date("TIMESTAMP"),
//       UpdateTime: new Date("TIMESTAMP"),
//       Action: "UPDATE" || "CREATE",
//       State: "QUEUED" || "IN_PROGRESS" || "SUCCESS" || "STOPPED" || "FAILED",
//       Error: { // ErrorDetail
//         ErrorCode: "STRING_VALUE",
//         ErrorMessage: "STRING_VALUE",
//       },
//       Details: { // StatusDetails
//         RequestedChange: {
//           Name: "STRING_VALUE", // required
//           DatabaseName: "STRING_VALUE",
//           Description: "STRING_VALUE",
//           Owner: "STRING_VALUE",
//           CreateTime: new Date("TIMESTAMP"),
//           UpdateTime: new Date("TIMESTAMP"),
//           LastAccessTime: new Date("TIMESTAMP"),
//           LastAnalyzedTime: new Date("TIMESTAMP"),
//           Retention: Number("int"),
//           StorageDescriptor: {
//             Columns: "<ColumnList>",
//             Location: "STRING_VALUE",
//             AdditionalLocations: [
//               "STRING_VALUE",
//             ],
//             InputFormat: "STRING_VALUE",
//             OutputFormat: "STRING_VALUE",
//             Compressed: true || false,
//             NumberOfBuckets: Number("int"),
//             SerdeInfo: {
//               Name: "STRING_VALUE",
//               SerializationLibrary: "STRING_VALUE",
//               Parameters: "<ParametersMap>",
//             },
//             BucketColumns: "<NameStringList>",
//             SortColumns: [
//               {
//                 Column: "STRING_VALUE", // required
//                 SortOrder: Number("int"), // required
//               },
//             ],
//             Parameters: "<ParametersMap>",
//             SkewedInfo: {
//               SkewedColumnNames: "<NameStringList>",
//               SkewedColumnValues: [
//                 "STRING_VALUE",
//               ],
//               SkewedColumnValueLocationMaps: {
//                 "<keys>": "STRING_VALUE",
//               },
//             },
//             StoredAsSubDirectories: true || false,
//             SchemaReference: {
//               SchemaId: {
//                 SchemaArn: "STRING_VALUE",
//                 SchemaName: "STRING_VALUE",
//                 RegistryName: "STRING_VALUE",
//               },
//               SchemaVersionId: "STRING_VALUE",
//               SchemaVersionNumber: Number("long"),
//             },
//           },
//           PartitionKeys: "<ColumnList>",
//           ViewOriginalText: "STRING_VALUE",
//           ViewExpandedText: "STRING_VALUE",
//           TableType: "STRING_VALUE",
//           Parameters: "<ParametersMap>",
//           CreatedBy: "STRING_VALUE",
//           IsRegisteredWithLakeFormation: true || false,
//           TargetTable: {
//             CatalogId: "STRING_VALUE",
//             DatabaseName: "STRING_VALUE",
//             Name: "STRING_VALUE",
//             Region: "STRING_VALUE",
//           },
//           CatalogId: "STRING_VALUE",
//           VersionId: "STRING_VALUE",
//           FederatedTable: {
//             Identifier: "STRING_VALUE",
//             DatabaseIdentifier: "STRING_VALUE",
//             ConnectionName: "STRING_VALUE",
//           },
//           ViewDefinition: {
//             IsProtected: true || false,
//             Definer: "STRING_VALUE",
//             SubObjects: [
//               "STRING_VALUE",
//             ],
//             Representations: [
//               {
//                 Dialect: "REDSHIFT" || "ATHENA" || "SPARK",
//                 DialectVersion: "STRING_VALUE",
//                 ViewOriginalText: "STRING_VALUE",
//                 ViewExpandedText: "STRING_VALUE",
//                 ValidationConnection: "STRING_VALUE",
//                 IsStale: true || false,
//               },
//             ],
//           },
//           IsMultiDialectView: true || false,
//           Status: {
//             RequestedBy: "STRING_VALUE",
//             UpdatedBy: "STRING_VALUE",
//             RequestTime: new Date("TIMESTAMP"),
//             UpdateTime: new Date("TIMESTAMP"),
//             Action: "UPDATE" || "CREATE",
//             State: "QUEUED" || "IN_PROGRESS" || "SUCCESS" || "STOPPED" || "FAILED",
//             Error: {
//               ErrorCode: "STRING_VALUE",
//               ErrorMessage: "STRING_VALUE",
//             },
//             Details: {
//               RequestedChange: "<Table>",
//               ViewValidations: [ // ViewValidationList
//                 { // ViewValidation
//                   Dialect: "REDSHIFT" || "ATHENA" || "SPARK",
//                   DialectVersion: "STRING_VALUE",
//                   ViewValidationText: "STRING_VALUE",
//                   UpdateTime: new Date("TIMESTAMP"),
//                   State: "QUEUED" || "IN_PROGRESS" || "SUCCESS" || "STOPPED" || "FAILED",
//                   Error: "<ErrorDetail>",
//                 },
//               ],
//             },
//           },
//         },
//         ViewValidations: [
//           {
//             Dialect: "REDSHIFT" || "ATHENA" || "SPARK",
//             DialectVersion: "STRING_VALUE",
//             ViewValidationText: "STRING_VALUE",
//             UpdateTime: new Date("TIMESTAMP"),
//             State: "QUEUED" || "IN_PROGRESS" || "SUCCESS" || "STOPPED" || "FAILED",
//             Error: "<ErrorDetail>",
//           },
//         ],
//       },
//     },
//   },
// };

GetTableCommand Input

See GetTableCommandInput for more details

Parameter
Type
Description
DatabaseName
Required
string | undefined

The name of the database in the catalog in which the table resides. For Hive compatibility, this name is entirely lowercase.

Name
Required
string | undefined

The name of the table for which to retrieve the definition. For Hive compatibility, this name is entirely lowercase.

CatalogId
string | undefined

The ID of the Data Catalog where the table resides. If none is provided, the Amazon Web Services account ID is used by default.

IncludeStatusDetails
boolean | undefined

Specifies whether to include status details related to a request to create or update an Glue Data Catalog view.

QueryAsOfTime
Date | undefined

The time as of when to read the table contents. If not set, the most recent transaction commit time will be used. Cannot be specified along with TransactionId.

TransactionId
string | undefined

The transaction ID at which to read the table contents.

GetTableCommand Output

See GetTableCommandOutput for details

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.
Table
Table | undefined

The Table object that defines the specified table.

Throws

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.

ResourceNotReadyException
client

A resource was not ready for a transaction.

GlueServiceException
Base exception class for all service exceptions from Glue service.